Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to describe negative behaviour #41

Closed
KirillSuhodolov opened this issue Oct 9, 2017 · 4 comments
Closed

Is it possible to describe negative behaviour #41

KirillSuhodolov opened this issue Oct 9, 2017 · 4 comments

Comments

@KirillSuhodolov
Copy link

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

#18
#20

@pokonski
Copy link
Contributor

pokonski commented Oct 9, 2017

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.

@KirillSuhodolov
Copy link
Author

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?

@pokonski
Copy link
Contributor

pokonski commented Oct 10, 2017

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.

@pokonski
Copy link
Contributor

Closing as it's answered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants