Is there any way to automatically initiate abort w...
# ask-the-community
t
Is there any way to automatically initiate abort within a flyte workflow execution if a given condition is met using the python SDK? Looking to terminate a workflow early if there are no changes to the original database. Thank you!
See documentation here in the state machine diagram for there being support for user initiated abort, but couldn't find the exact execution syntax
j
wouldnt a graceful exit be better than aborting if you know the cause of it?
t
@Daniel Xenes
d
Graceful exit would be good too! The main thing we want to do is programmatically exit the workflow based on a condition or status code in the task-decorated function so subsequent tasks don’t even start. Or maybe you can gracefully exit/abort in the workflow function?
j
I see, in our workflows i usually separate the checking stage and the rest of the workflow then wrap them in either dynamic task or conditional statement in outer workflow, maybe this use case does not apply to yours 🤔
d
Hmm reading about dynamic workflows it seems like I could wrap my tasks around that and have conditionals for it to go to a “cheaper” runway if the heavier tasks are not needed.
But yeah our use case is an automated cron job workflow running nightly where if an early tasks says “hey I got nothing to update on this DB” then the next 10 tasks don’t need to run and it would save us a lot of pods spinning up for no reason
j
i see, yeah using dynamic might be the easier and more readable solution 🤔 also probably looks good on your flyteconsole haha instead of bunch of red aborts
k
You can simply use Flyte static conditionals
j
is it different than the regular conditional? https://docs.flyte.org/projects/flytekit/en/latest/generated/flytekit.conditional.html i couldnt find any info on static conditional