-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdummy_tasks.py
47 lines (34 loc) · 936 Bytes
/
dummy_tasks.py
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
import os
from datetime import datetime
from time import sleep
from click.testing import CliRunner
from flytekit import ImageSpec, task, workflow
from flytekit.clis.sdk_in_container import pyflyte
image_spec = ImageSpec(
name="flyte-conformance",
registry="ghcr.io/unionai",
packages=["pandas"],
)
@task(container_image=image_spec, cache=True, cache_version="1.0")
def t1(x: int) -> datetime:
print(x)
return datetime.now()
@task(container_image=image_spec)
def t2(second: int):
sleep(second)
@task(container_image=image_spec)
def t3() -> str:
return os.getenv("HELLO")
@workflow
def wf(second: int = 60):
"""
Dummy workflow for functional test.
"""
for i in range(5):
t2(second=second)
if __name__ == "__main__":
runner = CliRunner()
result = runner.invoke(
pyflyte.main, ["-vv", "run", "--remote", "dummy_tasks.py", "wf"]
)
print(result.output)