Anton Buyskikh
10/17/2024, 11:55 AMimport prefect
import prefect.context
@prefect.task
def foo():
task_name = prefect.context.get_run_context().task.name
condition = <if task_name had no associated task_run_ids in the past>
if condition:
print("hello")
else:
print("world")
@prefect.flow
def bar():
foo()
if __name__ == "__main__":
bar()
how can I write condition
that would check if this task has at least one run record in the past? The behaviour should be that on the first run I get "hello"
printed, and all following ones would print "world"