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

Jobs that eventually succeed will not queue downstream jobs #61

Closed
jdreic opened this issue Oct 19, 2018 · 6 comments
Closed

Jobs that eventually succeed will not queue downstream jobs #61

jdreic opened this issue Oct 19, 2018 · 6 comments
Labels

Comments

@jdreic
Copy link

jdreic commented Oct 19, 2018

When a job throws an exception, Gush marks it as failed and reraises the error. Job frameworks like Sidekiq retry failed jobs by default. When a job has failed but later succeeds, since Gush marked the job as failed from the first run, downstream jobs that depend on it won't run.

It would be great if there was an option to unset the failed status if a job re-runs, so that if it succeeds, the downstream workflow can continue.

@pokonski
Copy link
Contributor

pokonski commented Nov 7, 2018

Hey @jdreic, thanks for the report. This sounds like a bug!

@pokonski pokonski added the bug label Nov 7, 2018
@theo-delaune-argus
Copy link

theo-delaune-argus commented Mar 11, 2019

Hi,

The problem occurs in the job parameters.
If job first launch failed, it set @failed_at = time of fail.
But when job is replayed, @failed_at is not resetted to nil.

If you take look at https://github.com/chaps-io/gush/blob/master/lib/gush/worker.rb#L73, when children jobs are enqueued, it checks if parent has succeeded.
Since the parent job still had the @failed_at non-nil, the children are not enqueued.

This is my fix :

# Override Gush::Job start!
# To ensure failed_at is reset when job is relaunched by Sidekiq
class BaseJob < Gush::Job
  def start!
    super
    @failed_at = nil
  end
end

@mickael-palma-argus
Copy link

Hi,

I prefer using refinements 😄

# Temporary fix: https://github.com/chaps-io/gush/issues/61
# Overrides Gush::Job start! method.
# Resets failed_at variable when Sidekiq reloads a job.
module GushJobFix
  refine Gush::Job do
    def start!
      super
      @failed_at = nil
    end
  end
end

class MyJob < Gush::Job
  using GushJobFix

  def perform
    ...
  end
end

@pokonski
Copy link
Contributor

Hey guys! Thank you for finding the culprit! Will release a fix ASAP!

@pokonski
Copy link
Contributor

pokonski commented Mar 12, 2019

@mickael-palma-argus @theo-delaune-argus @jdreic this is now released as 2.0.1, thanks again for the report and help with identifying the issue ❤️

/cc @devilankur18 @hqm42 @vadshalamov

@mickael-palma-argus
Copy link

You rock 👍
Great specs BTW 😃

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

No branches or pull requests

4 participants