Class: BatchKit::Task::Run
- Defined in:
- lib/batch-kit/framework/task_run.rb
Overview
Captures details of an execution of a task.
Instance Attribute Summary collapse
-
#job_run ⇒ Job::Run
readonly
The job run that this task is running under.
-
#task_run_id ⇒ Fixnum
An integer identifier that uniquely identifies this task run.
Attributes inherited from Runnable
#definition, #end_time, #exception, #exit_code, #instance, #lock_name, #lock_timeout, #lock_wait_timeout, #object, #start_time, #status
Instance Method Summary collapse
-
#initialize(task_def, job_object, job_run, *run_args) ⇒ Run
constructor
Create a new task run.
-
#persist? ⇒ Boolean
True if this task run should be persisted in any persistence layer.
-
#to_s ⇒ String
A short representation of this Task::Run.
Methods inherited from Runnable
#abort, add_delegated_properties, #around_execute, #elapsed, #event_name, #failure, #label, #post_execute, #pre_execute, #success
Methods included from Lockable
Constructor Details
#initialize(task_def, job_object, job_run, *run_args) ⇒ Run
Create a new task run.
27 28 29 30 31 32 33 |
# File 'lib/batch-kit/framework/task_run.rb', line 27 def initialize(task_def, job_object, job_run, *run_args) raise ArgumentError, "task_def not a Task::Definition" unless task_def.is_a?(Task::Definition) raise ArgumentError, "job_run not a Job::Run" unless job_run.is_a?(Job::Run) @job_run = job_run @job_run << self super(task_def, job_object, run_args) end |
Instance Attribute Details
#job_run ⇒ Job::Run (readonly)
Returns The job run that this task is running under.
9 10 11 |
# File 'lib/batch-kit/framework/task_run.rb', line 9 def job_run @job_run end |
#task_run_id ⇒ Fixnum
Returns An integer identifier that uniquely identifies this task run.
12 13 14 |
# File 'lib/batch-kit/framework/task_run.rb', line 12 def task_run_id @task_run_id end |
Instance Method Details
#persist? ⇒ Boolean
Returns True if this task run should be persisted in any persistence layer.
38 39 40 |
# File 'lib/batch-kit/framework/task_run.rb', line 38 def persist? !definition.job.do_not_track end |
#to_s ⇒ String
Returns A short representation of this Task::Run.
44 45 46 |
# File 'lib/batch-kit/framework/task_run.rb', line 44 def to_s "<BatchKit::Task::Run label='#{label}'>" end |