-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsleepTaskFlow.py
More file actions
47 lines (39 loc) · 986 Bytes
/
sleepTaskFlow.py
File metadata and controls
47 lines (39 loc) · 986 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from prefect import flow, task
import time
@task(log_prints=True)
def name_task(name):
print("hello again", name)
return "hello again"
@task(log_prints=True)
def sleep_task(sleepLength:int=10):
time.sleep(sleepLength)
print("slept")
return "slept"
@flow(log_prints=True)
def sleep_task_flow(name:str="world", sleepLength:int=10):
'''### Sleep task flow
```python
from prefect import flow, task
from prefect import time
@task(log_prints=True)
def name_task(name):
print("hello again", name)
return "hello again"
@task(log_prints=True)
def sleep_task(sleepLength:int=10):
time.sleep(sleepLength)
print("slept")
return "slept"
@flow(log_prints=True)
def sleep_task_flow(name:str="world"sleepLength:int=10):
name_task()
print("hello", name)
return 'hello'
```
'''
name_task(name)
sleep_task(sleepLength)
print("hello", name)
return 'hello'
if __name__ == '__main__':
sleep_task_flow.serve(name='world')