https://prefect.io logo
#prefect-community
Title
# prefect-community
a

Arsenii

12/10/2019, 11:58 AM
Hi all, a question regarding triggers and Prefect-specific best practices. I'm writing a dynamically-built flow that basically consists of three tasks: 1. Get the list of items to work with 2. Map a function to the items on that list. The task might raise a
SKIP
halfway if some condition is met 3. Map a function to the results of step 2 I'm coming from an airflow background and was expecting a
none_skipped
trigger to apply to step 3, with the expected behavior that it would run if and only if step 2 succeeded. But as far as I understood, all triggers in Prefect treat skipping as success, which is not what I want. So my question is, is this designed to defer people from not using Prefect in a non-Prefect way? Should I instead use branching logic? Or is it a known missing feature to be implemented later? This is easily workaround-able with some manual checking logic in step 3 but still. Thanks!
e

emre

12/10/2019, 12:12 PM
Unlike Airflows
skipped
state, Prefects
SKIP
signal is only raised manually. This implies that receiving an upstream
SKIP
signal is intentional by the developer, and is treated like a success. There doesn’t seem to be any built in triggers for your case, but I believe you can implement a custom trigger to suit your usage pretty easily. Check out the built in trigger implementations, they are pretty minimal: https://github.com/PrefectHQ/prefect/blob/master/src/prefect/triggers.py
c

Chris White

12/10/2019, 3:20 PM
Hi @Arsenii - I believe the trigger you are looking for we merged yesterday! https://github.com/PrefectHQ/prefect/pull/1787
a

Arsenii

12/11/2019, 5:09 AM
Thank you @emre it's actually pretty easy to write a custom one, you're right
Hi @Chris White and thanks for the heads-up! Great timing, I also learned about the
skip_on_upstream_skip
parameter from the PR. Just to avoid confusion, in the documentation is it always implied that "upstream tasks" mean immediately upstream tasks?
💯 1
c

Chris White

12/11/2019, 5:13 AM
yup that is correct, we always mean immediately upstream
👍 1