https://prefect.io logo
d

Dean Magee

10/27/2020, 3:36 AM
👋 hello from Melbourne Australia!! Im trying to have my state handler output some more useful information other than just "task failed". I would like it to output the parameters of that specific flow run. Is there a way I can access these within my state handler?
👋 1
c

Chris White

10/27/2020, 3:39 AM
Hello @Dean Magee! Yes, you should be able to access flow run parameters via `prefect.context`:
Copy code
prefect.context.parameters # a dictionary of parameter name -> value
d

Dean Magee

10/27/2020, 4:06 AM
do you mean something like....
Copy code
def alert_failed(obj, old_state, new_state):
    if new_state.is_failed():
        print(prefect.context.parameters)
        
    return new_state
c

Chris White

10/27/2020, 4:08 AM
yup yup, exactly
🙌 1
d

Dean Magee

10/28/2020, 3:26 AM
Great. Thanks!