Class: Taskinator::Task::SubProcess
- Inherits:
-
Taskinator::Task
- Object
- Taskinator::Task
- Taskinator::Task::SubProcess
- Defined in:
- lib/taskinator/task.rb
Overview
a task which delegates to another process
Instance Attribute Summary collapse
-
#sub_process ⇒ Object
readonly
Returns the value of attribute sub_process.
Attributes inherited from Taskinator::Task
#next, #options, #process, #queue, #uuid
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #can_complete_task? ⇒ Boolean
-
#initialize(process, sub_process, options = {}) ⇒ SubProcess
constructor
A new instance of SubProcess.
- #start ⇒ Object
Methods inherited from Taskinator::Task
#<=>, base_key, #cancelled?, define_job_task, define_step_task, define_sub_process_task, #enqueue, #on_completed_entry, #on_failed_entry, #paused?, #reload, #to_s
Methods included from Persistence
add_process_to_list, deserialize, included, list_key, serialize
Constructor Details
#initialize(process, sub_process, options = {}) ⇒ SubProcess
Returns a new instance of SubProcess.
217 218 219 220 221 222 223 |
# File 'lib/taskinator/task.rb', line 217 def initialize(process, sub_process, ={}) super(process, ) raise ArgumentError, 'sub_process' if sub_process.nil? || !sub_process.is_a?(Process) @sub_process = sub_process @sub_process.parent = self end |
Instance Attribute Details
#sub_process ⇒ Object (readonly)
Returns the value of attribute sub_process.
215 216 217 |
# File 'lib/taskinator/task.rb', line 215 def sub_process @sub_process end |
Instance Method Details
#accept(visitor) ⇒ Object
236 237 238 239 |
# File 'lib/taskinator/task.rb', line 236 def accept(visitor) super visitor.visit_process(:sub_process) end |
#can_complete_task? ⇒ Boolean
231 232 233 234 |
# File 'lib/taskinator/task.rb', line 231 def can_complete_task? # NOTE: this works out-of-process, so there isn't any issue sub_process.completed? end |
#start ⇒ Object
225 226 227 228 229 |
# File 'lib/taskinator/task.rb', line 225 def start Taskinator.instrumenter.instrument(:execute_subprocess, :uuid => uuid) do sub_process.start! end end |