Class: AcidicJob::Execution
- Defined in:
- app/models/acidic_job/execution.rb
Instance Method Summary collapse
- #context ⇒ Object
- #deserialized_job ⇒ Object
- #enqueue_job ⇒ Object
- #finished? ⇒ Boolean
- #raw_arguments ⇒ Object
- #record!(step:, action:, timestamp:, **kwargs) ⇒ Object
Instance Method Details
#context ⇒ Object
27 28 29 |
# File 'app/models/acidic_job/execution.rb', line 27 def context @context ||= Context.new(self) end |
#deserialized_job ⇒ Object
35 36 37 38 39 |
# File 'app/models/acidic_job/execution.rb', line 35 def deserialized_job serialized_job["job_class"].constantize.new.tap do |job| job.deserialize(serialized_job) end end |
#enqueue_job ⇒ Object
45 46 47 48 |
# File 'app/models/acidic_job/execution.rb', line 45 def enqueue_job deserialized_job.enqueue true end |
#finished? ⇒ Boolean
31 32 33 |
# File 'app/models/acidic_job/execution.rb', line 31 def finished? recover_to.to_s == FINISHED_RECOVERY_POINT end |
#raw_arguments ⇒ Object
41 42 43 |
# File 'app/models/acidic_job/execution.rb', line 41 def raw_arguments JSON.parse(serialized_job_before_type_cast)["arguments"] end |
#record!(step:, action:, timestamp:, **kwargs) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'app/models/acidic_job/execution.rb', line 16 def record!(step:, action:, timestamp:, **kwargs) AcidicJob.instrument(:record_entry, step: step, action: action, timestamp: , data: kwargs) do entries.create!( step: step, action: action, timestamp: , data: kwargs.stringify_keys! ) end end |