Joseph Haaga10/23/2020, 7:39 PM
only defined inside that contexthandler/`with` statement?
I’m getting the following
from prefect import task, Flow @task def say_hello(): print("Hello, world!") with Flow("Run Me") as flow: h = say_hello() flow.run() # prints "Hello, world!"
NameError: name 'flow' is not defined
Alexander10/23/2020, 7:41 PM
Please check your environment
[2020-10-23 19:42:19] INFO - prefect.FlowRunner | Beginning Flow run for 'Run Me' [2020-10-23 19:42:19] INFO - prefect.TaskRunner | Task 'say_hello': Starting task run... Hello, world! [2020-10-23 19:42:19] INFO - prefect.TaskRunner | Task 'say_hello': finished task run for task with final state: 'Success' [2020-10-23 19:42:19] INFO - prefect.FlowRunner | Flow run SUCCESS: all reference tasks succeeded
Billy McMonagle10/23/2020, 8:27 PM
exists outside of the
block. The resource which is aliased as
is "open" for the duration of the
block, and "closed" upon exiting the
block, but the object itself persists and can have methods called.
Joseph Haaga10/23/2020, 8:29 PM
gets called; interesting - thanks!