2022-10-20 03:24:27 +00:00
|
|
|
import os
|
|
|
|
|
|
|
|
import lightning as L
|
|
|
|
from lightning_app import CloudCompute
|
|
|
|
from lightning_app.storage import Mount
|
|
|
|
|
|
|
|
|
|
|
|
class Work(L.LightningWork):
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
super().__init__(*args, **kwargs)
|
|
|
|
|
|
|
|
def run(self):
|
|
|
|
files = os.listdir("/content/esRedditJson/")
|
|
|
|
for file in files:
|
|
|
|
print(file)
|
|
|
|
assert "esRedditJson1" in files
|
|
|
|
|
|
|
|
|
|
|
|
class Flow(L.LightningFlow):
|
|
|
|
def __init__(self):
|
|
|
|
super().__init__()
|
|
|
|
self.work_1 = Work(
|
|
|
|
cloud_compute=CloudCompute(
|
|
|
|
mounts=Mount(
|
|
|
|
source="s3://ryft-public-sample-data/esRedditJson/",
|
2022-10-20 21:33:35 +00:00
|
|
|
mount_path="/content/esRedditJson/",
|
2022-10-20 03:24:27 +00:00
|
|
|
),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
def run(self):
|
|
|
|
self.work_1.run()
|
|
|
|
|
|
|
|
|
2022-11-09 20:46:31 +00:00
|
|
|
app = L.LightningApp(Flow(), log_level="debug")
|