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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.clear_finishedObject



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/acidic_job/run.rb', line 24

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



293
294
295
296
297
# File 'lib/acidic_job/run.rb', line 293

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)


36
37
38
# File 'lib/acidic_job/run.rb', line 36

def succeeded?
  finished? && !errored?
end