lightning/docs/source-app/levels/intermediate/scripts/comms_1.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
526 B
Python
Raw Normal View History

# app.py
from lightning.app import LightningWork, LightningFlow, LightningApp
class Component(LightningWork):
def run(self, x):
print(f'MACHINE 1: this string came from machine 0: "{x}"')
print('MACHINE 1: this string is on machine 1')
class WorkflowOrchestrator(LightningFlow):
def __init__(self) -> None:
super().__init__()
self.component = Component()
def run(self):
x = 'hello from machine 0'
self.component.run(x)
app = LightningApp(WorkflowOrchestrator())