Class: BatchProcessor::BatchJob
- Inherits:
-
ActiveJob::Base
- Object
- ActiveJob::Base
- BatchProcessor::BatchJob
show all
- Includes:
- Technologic
- Defined in:
- lib/batch_processor/batch_job.rb
Defined Under Namespace
Classes: BatchAbortedError
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
#batch_id ⇒ Object
Returns the value of attribute batch_id.
6
7
8
|
# File 'lib/batch_processor/batch_job.rb', line 6
def batch_id
@batch_id
end
|
#tracked_batch_running ⇒ Object
Returns the value of attribute tracked_batch_running.
6
7
8
|
# File 'lib/batch_processor/batch_job.rb', line 6
def tracked_batch_running
@tracked_batch_running
end
|
Instance Method Details
#batch ⇒ Object
53
54
55
56
57
|
# File 'lib/batch_processor/batch_job.rb', line 53
def batch
return unless batch_job?
@batch ||= BatchProcessor::BatchBase.find(batch_id)
end
|
#batch_job? ⇒ Boolean
59
60
61
|
# File 'lib/batch_processor/batch_job.rb', line 59
def batch_job?
batch_id.present?
end
|
#deserialize(job_data) ⇒ Object
48
49
50
51
|
# File 'lib/batch_processor/batch_job.rb', line 48
def deserialize(job_data)
super(job_data)
self.batch_id = job_data["batch_id"]
end
|
#rescue_with_handler(exception) ⇒ Object
30
31
32
33
34
35
36
|
# File 'lib/batch_processor/batch_job.rb', line 30
def rescue_with_handler(exception)
batch.job_canceled and return exception if exception.is_a?(BatchAbortedError)
batch_job_failure(exception) if batch_job?
super
end
|
#retry_job ⇒ Object
38
39
40
41
42
|
# File 'lib/batch_processor/batch_job.rb', line 38
def retry_job(*)
return if batch_job? && batch.processor_class.disable_retries?
super
end
|
#serialize ⇒ Object
44
45
46
|
# File 'lib/batch_processor/batch_job.rb', line 44
def serialize
super.merge("batch_id" => batch_id) end
|