Arun Giridharan
12/02/2021, 1:04 AMKevin Kho
wait=True in your StartFlowRunArun Giridharan
12/03/2021, 1:42 AMflow_run = StartFlowRun(flow_name="process", project_name="sandbox", wait=true)
with prefect.Flow("download") as flow_download:
fp = "plip"
check = check_file(fp)
download = download_file(check)
run = flow_run(run_name=f"process_{fp}", parameters={'fp': fp})
For my test I would like to assert that process actually passed. I can verify download passed using the state.is_sucessful() method. Is there a way to do this for process ?Kevin Kho
wait=True will raise the state so if it fails, that task should fail also. Are you checking for success in a state handler?Arun Giridharan
12/03/2021, 1:46 AMdef test_flow_results(monkeypatch):
flow = create_flow()
state = flow.run(
parameters={
...
},
}
)
# Test running the flow does not produce any obvious errors
assert state.is_successful()Arun Giridharan
12/03/2021, 1:47 AMflow_download flow, but I'm not sure how to check for success in the process flow?Kevin Kho
StartFlowRun and if it’s running with an env variable, just raise success, otherwise actually run the task. So you can do something like that to test it.
Similarly, I think you have to Mock the task itself to test it so that the API call to start a flow run is not triggered. With your Mock, you can raise Success to raise the state.