Tim Enders
10/24/2022, 2:08 PMisinstance(blah, Failed)
but Failed isn't a type. Here is a code snippet:
if isinstance(bq_result, LoadJob) and bq_result.state == "DONE":
return Completed(message="Load Finished!")
elif isinstance(bq_result, Failed):
slack_webhook_block = SlackWebhook.load("data-pipeline-notifications")
slack_webhook_block.notify("Hello from Prefect 2.0!")
return bq_result
else:
Rob Freedy
10/24/2022, 2:45 PMZanie
10/24/2022, 3:24 PMFailed
is a convenience function for creating a `State(type=StateType.FAILED)`; you can check if a state is failed with state.is_failed()
Tim Enders
10/24/2022, 6:42 PM<class 'prefect.exceptions.MissingResult'>: State data is missing. Typically, this occurs when result persistence is disabled and the state has been retrieved from the API.
Zanie
10/24/2022, 6:55 PMNone
to tell if data has been persisted now.data="something"
to your Completed
state and it should work. Or data=LiteralResult(value=None)
Tim Enders
10/24/2022, 7:00 PM