Sam P.
11/07/2023, 11:11 PMMarvin
11/07/2023, 11:12 PMNate
11/07/2023, 11:13 PMdef some_hook(flow, flow_run, state):
# do whatever
pass
@flow(on_completion=[some_hook])Sam P.
11/07/2023, 11:14 PMSam P.
11/07/2023, 11:17 PMSam P.
11/07/2023, 11:18 PMrun_deployment and create_flow_run_from_deployment?Nate
11/07/2023, 11:20 PMreturn_state=True to suppress exceptions raised by tasks or flows so they dont raise in the calling parent
@task
def foo():
raise ValueError()
@flow(log_prints=True)
def resilient():
state = foo(return_state=True)
if state.is_failed():
print("its ok")
return 42Nate
11/07/2023, 11:21 PMrun_deployment is our SDK utility for hitting the api and creating a flow run from deployment, where the api endpoint i think is literally create_flow_run_from_deploymentSam P.
11/07/2023, 11:22 PMNate
11/07/2023, 11:23 PMrun_deployment blocks until the underlying flow finishes by default, unless you pass timeout=0 (fire and forget)Sam P.
11/07/2023, 11:24 PM