Is it possible to describe negative behaviour
KirillSuhodolov opened this issue · 4 comments
For example, how to branching workflow and run described job if some job in workflow failed or event workflow failed?
How is it difficult to implement and have it sense?
Because just rerun failed job not that need. Usually jobs can work with third party services and that services can responded with errors.
At such case when job failed workflow should continue executing due it know how to process such error and even wait for error.
Let me provide synthetic example:
class SupplierWorkflow < Gush::Workflow
def configure()
run AskSupplierAboutAvailableAmount
run TryToOrderProducts
run OrderSuccess, after_success: TryToOrderProducts
run OrderFail, after_fail: TryToOrderProducts
# one of them never executes
run SendMailReport, after_or: [OrderSuccess, OrderFail]
end
end
may be related issues
I don't plan on handling failing jobs. The idea is simple, if job fails, the workflow won't continue.
If you expect failures then you should handle them inside that particular job.
Not good idea to run other jobs or workflows inside job. Job should be independent. And workflow describe when, how and execution order.
Workflows looks similar in many parts with saga(process manager) pattern, that can process failed events.
So, I am interesting how you work with such cases, or may be just ignore them?
Yes I ignore them. I consider jobs which fail to be workflow-stopping. It's either all or nothing. For me dynamically changing worklows are a bad practice.
You can use payloads to pass info if the previous job failed and act accordingly. The OrderSuccess
and OrderFail
don't have to be separate jobs. They can be separate services running conditionally in job.
Closing as it's answered.