Class: Delayed::JobGroups::Plugin

Inherits:
Plugin
  • Object
show all
Defined in:
lib/delayed/job_groups/plugin.rb

Class Method Summary collapse

Class Method Details

.job_acceptably_failed?(job) ⇒ Boolean

Returns:

  • (Boolean)


47
48
49
50
51
# File 'lib/delayed/job_groups/plugin.rb', line 47

def self.job_acceptably_failed?(job)
  # Job has set failed_at (retries have maxed out) and failure_cancels_group is false signaling
  # that the group should complete despite failures.
  job.failed_at.present? && job.job_group.present? && !job.job_group.failure_cancels_group?
end

.job_completed?(job) ⇒ Boolean

Returns:

  • (Boolean)


41
42
43
44
45
# File 'lib/delayed/job_groups/plugin.rb', line 41

def self.job_completed?(job)
  # Delayed job will already have marked the job for destruction
  # if it has completed
  job.destroyed?
end

.job_group_cancelled?(job_group_id) ⇒ Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/delayed/job_groups/plugin.rb', line 37

def self.job_group_cancelled?(job_group_id)
  !JobGroup.exists?(job_group_id)
end