is it possible to pass parameters to the callable ...
# prefect-server
v
is it possible to pass parameters to the callable called by the
on_failure
param of a flow? Should the function called by
on_failure
be able to read your flow's results?
k
If your state handler is defined like:
Copy code
def st_handler(task, old_state, new_state):
    ...
You can try doing
new_state.result
to get the result. What kind of parameters are you trying to pass?
v
my on_failure handler is defined as
def *clean_on_failure*(flow: *Flow*, state: *State*)
and I am trying to pass the directory to remove
I tried accessing using state.result
k
Ah on the Flow level the results are not kept because they can be too big. For
flow.run()
you will see them but when running with a backend (Server or Cloud), they are not stored.
v
so is there anyway to pass additional \*args/\**kwargs on the flow level?
^sorry if this is confusing to read lol, escaped the asterisk to stop bolding
k
Maybe you can persist it in the KV Store ?
v
KV store won't work in server, right?
k
Oh that’s true it’s Cloud only. What kind of args and kwargs are you passing?
If it’s parameters, you can use
prefect.context.parameters
v
directory_to_clean=f"/output/{uuid}"
it is a parameter based value yes
k
Copy code
def st_handler(flow, old_state, new_state):
    myparam = prefect.context.parameters.get("myparam")
something like this
v
oh that works
thanks!
k
Nice!