Class: AcidicJob::Run

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
GlobalID::Identification
Defined in:
lib/acidic_job/run.rb

Constant Summary collapse

FINISHED_RECOVERY_POINT =
"FINISHED"
STAGED_JOB_ID_PREFIX =
"STG"
STAGED_JOB_ID_DELIMITER =
"__"
IDEMPOTENCY_KEY_LOCK_TIMEOUT_SECONDS =
2
RAILS_VERSION =
Gem::Version.new(ActiveRecord.version)
TARGET_VERSION =
Gem::Version.new("7.1")
REQUIRES_CODER_FOR_SERIALIZE =
RAILS_VERSION >= TARGET_VERSION ||
RAILS_VERSION.segments[..1] == TARGET_VERSION.segments

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.clear_finishedObject



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/acidic_job/run.rb', line 28

def self.clear_finished
  # over-write any pre-existing relation queries on `recovery_point` and/or `error_object`
  to_purge = finished

  count = to_purge.count

  return 0 if count.zero?

  AcidicJob.logger.info("Deleting #{count} finished AcidicJob runs")
  to_purge.delete_all
end

Instance Method Details

#not_awaited_but_unstagedObject



314
315
316
317
318
# File 'lib/acidic_job/run.rb', line 314

def not_awaited_but_unstaged
  return true unless awaited? && !staged?

  errors.add(:base, "cannot be awaited by another job but not staged")
end

#succeeded?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/acidic_job/run.rb', line 40

def succeeded?
  finished? && !errored?
end