Jason Damiani
07/17/2019, 3:52 PMJason Damiani
07/17/2019, 3:56 PMdef handle_state(flow, old_state, new_state):
def param_value_for(param_name, state):
p = next(filter(lambda k: k.name == param_name, new_state.result.keys()))
r = state.result[p]
return r.result
if new_state.is_running():
foo = param_value_for('foo', new_state)
print('Starting to run')
elif new_state.is_failed():
foo = param_value_for('foo', new_state)
print(f'We have a failure for {foo}')
elif new_state.is_successful():
foo = param_value_for('foo', new_state)
print(f'We have a success for {foo}')
Chris White
prefect.context
for the flow parameters:
p = prefect.context.get("parameters", {}).get(param_name)
this should be populated at the time of your flow’s state handlers being calledJason Damiani
07/17/2019, 4:01 PMChris White
Jason Damiani
07/17/2019, 4:22 PMChris White
Jeremiah
Chris White
Jason Damiani
07/17/2019, 7:10 PMChris White
Marvin
08/05/2019, 9:41 PM