Class: BatchProcessor::BatchJob
- Inherits:
-
ActiveJob::Base
- Object
- ActiveJob::Base
- BatchProcessor::BatchJob
show all
- 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
|
Instance Method Details
#batch ⇒ Object
49
50
51
52
53
|
# File 'lib/batch_processor/batch_job.rb', line 49
def batch
return unless batch_job?
@batch ||= BatchProcessor::BatchBase.find(batch_id)
end
|
#batch_job? ⇒ Boolean
55
56
57
|
# File 'lib/batch_processor/batch_job.rb', line 55
def batch_job?
batch_id.present?
end
|
#deserialize(job_data) ⇒ Object
44
45
46
47
|
# File 'lib/batch_processor/batch_job.rb', line 44
def deserialize(job_data)
super(job_data)
self.batch_id = job_data["batch_id"]
end
|
#rescue_with_handler(exception) ⇒ Object
26
27
28
29
30
31
32
|
# File 'lib/batch_processor/batch_job.rb', line 26
def rescue_with_handler(exception)
batch.job_canceled and return exception if exception.is_a?(BatchAbortedError)
batch.job_failure if batch_job?
super
end
|
#retry_job ⇒ Object
34
35
36
37
38
|
# File 'lib/batch_processor/batch_job.rb', line 34
def retry_job(*)
return if batch_job? && batch.processor_class.disable_retries?
super
end
|
#serialize ⇒ Object
40
41
42
|
# File 'lib/batch_processor/batch_job.rb', line 40
def serialize
super.merge("batch_id" => batch_id) end
|