Hi guys, need some help with notifications upon fa...
# prefect-community
Hi guys, need some help with notifications upon failures: I have added a custon function that sends an email but it would very cool if the function could know the arguments that the task was run with (following instructions here. From what I have seen so far the task does not store its running args at the level of the object and the local task runner does not pass it down to the handler. The only solution i can see is storing the arguments of the run function when that is called which introduces statefulness. Am i missing sth ?
Hey @Konstantinos I don’t think task inputs are exposed to the state handlers however you could instead slightly refactor what you are doing to use the upstream task’s results in the state handler!
Copy code
def notif(tracked_obj, old_state, new_state):
    if new_state.is_successful():

    return new_state

def a():
    return 1234

def b(x):

with Flow("test") as flow:
    a = a()
    b = b(a)
This essentially is saying instead of looking at the inputs of the downstream look at the result of the upstream (which are the inputs to the downstream)
Hello @josh, thanks for the input. I guess if we are talking about tasks without upstream, then i can define a dummy upstream essentially returning the input of downstream. 🤔
might try this, thank you!