I want to do `trigger=all_successful` for the mapp...
# prefect-community
I want to do
for the mapped function, but it only works for unmapped tasks
Hey Jacques, How are you using triggers with your mapped task? Keep in mind whenever a mapped task is reduced by a downstream task, the trigger function will be applied to all of the mapped children. For example, if a reducing task as an 
 task but one of the mapped tasks fails, the reducing task’s trigger will fail. Note that triggers are only applied on the children tasks, not the parent.
Not sure I follow 100%, in my case it is the task feeding the mapped task that fails
and then the mapped task fails because it tries to process the error result from the first task
Hmm perhaps I’m misunderstanding, the mapping task’s trigger will apply to all of the mapped children tasks and any failures that occur will bubble to the parent task. However if you wanted to change the conditions of the trigger, you can use other trigger functions which are documented here. What was your expected behavior for your use case?
So I'm doing this
Copy code
extract_dummy = ExtractDummyTask(trigger=all_successful)
transform_dummy = TransformDummyTask(trigger=all_successful)
load_dummy = LoadDummyTask(trigger=all_successful)
# Create dummy flow
with Flow("dummy_flow") as flow:

    # Extract
    values = extract_dummy()

    # Transform
    transformed_values = transform_dummy.map(data=values)

    # Load
But if I make ExtractDummyTask raise a RuntimeError() then TransformDummyTask tries to run using the RuntimeError - this error specifically
Task 'TransformDummyTask': unexpected error while running task: TypeError("Cannot map over unsubscriptable object of type <class 'RuntimeError'>: RuntimeErr...")
load has the expected behaviour though:
Task 'LoadDummyTask': finished task run for task with final state: 'TriggerFailed'
Hey @Jacques, let me look into this and get back to you.
Thanks, appreciated!
Hey @Jacques, after asking internally this looks to be a bug - the mapped task shouldn’t attempt to iterate if the upstream task fails. Would it be possible to open an issue on github with a minimal reproducible example? I can help if needed.
Sure, give me a few mins to put something together
Hope that is good enough
👍 1
That’s great, thank you!