flaky-car-61813
02/06/2023, 8:40 AMsleep
(attached screenshot). But there is no example given, unfortunately.
Therefore, I'm asking here again: How would you use sleep
to trigger a task periodically inside a `@dynamic`workflow and how would the DAG look like in that case?tall-lock-23197
from datetime import timedelta
from flytekit import dynamic, task
from flytekit.core.gate import sleep
@task
def t1(a: int):
...
@dynamic
def wf_sleep(n: int):
for i in range(n):
x = sleep(timedelta(minutes=10))
b = t1(a=5)
x >> b
t1
task will be triggered n
number of times with a fixed interval of 10 minutes between every two triggers.flaky-car-61813
02/06/2023, 9:26 AMflaky-car-61813
02/06/2023, 9:44 AM@dynamic
workflows to be "real" dynamic. But unfortunately, they still require a known DAG. "Real" dynamic DAGs would be a nice addition to flyte imhotall-lock-23197
flaky-car-61813
02/06/2023, 11:14 AMfrom datetime import timedelta
from flytekit import dynamic, task
from flytekit.core.gate import sleep
@task
def t1(a: int):
...
@dynamic
def wf_sleep():
while True:
x = sleep(timedelta(minutes=10))
b = t1(a=5)
x >> b
flaky-car-61813
02/06/2023, 11:15 AMflaky-car-61813
02/06/2023, 11:16 AMdynamic
workflow cannot be evaluated pre runtime (while True)flaky-car-61813
02/06/2023, 11:16 AMflaky-car-61813
02/06/2023, 11:16 AMtall-lock-23197
while True
won't work. There should exist some sort of determinism.broad-monitor-993
02/06/2023, 2:48 PMfreezing-airport-6809