Class: ChainedJob::Process
- Inherits:
-
Object
- Object
- ChainedJob::Process
- Defined in:
- lib/chained_job/process.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#job_arguments_key ⇒ Object
readonly
Returns the value of attribute job_arguments_key.
-
#job_instance ⇒ Object
readonly
Returns the value of attribute job_instance.
-
#job_tag ⇒ Object
readonly
Returns the value of attribute job_tag.
-
#worker_id ⇒ Object
readonly
Returns the value of attribute worker_id.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(args, job_instance, job_arguments_key, worker_id, job_tag) ⇒ Process
constructor
A new instance of Process.
- #run ⇒ Object
Constructor Details
#initialize(args, job_instance, job_arguments_key, worker_id, job_tag) ⇒ Process
Returns a new instance of Process.
13 14 15 16 17 18 19 |
# File 'lib/chained_job/process.rb', line 13 def initialize(args, job_instance, job_arguments_key, worker_id, job_tag) @args = args @job_instance = job_instance @job_arguments_key = job_arguments_key @worker_id = worker_id @job_tag = job_tag end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
11 12 13 |
# File 'lib/chained_job/process.rb', line 11 def args @args end |
#job_arguments_key ⇒ Object (readonly)
Returns the value of attribute job_arguments_key.
11 12 13 |
# File 'lib/chained_job/process.rb', line 11 def job_arguments_key @job_arguments_key end |
#job_instance ⇒ Object (readonly)
Returns the value of attribute job_instance.
11 12 13 |
# File 'lib/chained_job/process.rb', line 11 def job_instance @job_instance end |
#job_tag ⇒ Object (readonly)
Returns the value of attribute job_tag.
11 12 13 |
# File 'lib/chained_job/process.rb', line 11 def job_tag @job_tag end |
#worker_id ⇒ Object (readonly)
Returns the value of attribute worker_id.
11 12 13 |
# File 'lib/chained_job/process.rb', line 11 def worker_id @worker_id end |
Class Method Details
.run(args, job_instance, job_arguments_key, worker_id, job_tag) ⇒ Object
7 8 9 |
# File 'lib/chained_job/process.rb', line 7 def self.run(args, job_instance, job_arguments_key, worker_id, job_tag) new(args, job_instance, job_arguments_key, worker_id, job_tag).run end |
Instance Method Details
#run ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/chained_job/process.rb', line 21 def run with_hooks do return finished_worker unless argument begin job_instance.process(argument) rescue StandardError => e push_job_arguments_back if handle_retry? raise e end job_instance.class.perform_later(args, worker_id, job_tag) end end |