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
#created_at, #next, #options, #process, #queue, #updated_at, #uuid
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #enqueue ⇒ Object
- #incr_count? ⇒ Boolean
-
#initialize(process, sub_process, options = {}) ⇒ SubProcess
constructor
NOTE: also wraps sequential and concurrent processes.
- #inspect ⇒ Object
- #start ⇒ Object
Methods inherited from Taskinator::Task
#<=>, base_key, #cancel!, #cancelled?, #complete!, define_job_task, define_step_task, define_sub_process_task, #enqueue!, #fail!, #paused?, #start!, #to_s
Methods included from Instrumentation
#cancelled_payload, #completed_payload, #enqueued_payload, #failed_payload, #instrument, #paused_payload, #processing_payload, #resumed_payload
Methods included from Persistence
add_process_to_list, deserialize, included, list_key, serialize
Methods included from Workflow
#current_state, #current_state=, #transition
Constructor Details
#initialize(process, sub_process, options = {}) ⇒ SubProcess
NOTE: also wraps sequential and concurrent processes
274 275 276 277 278 279 280 |
# File 'lib/taskinator/task.rb', line 274 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.
270 271 272 |
# File 'lib/taskinator/task.rb', line 270 def sub_process @sub_process end |
Instance Method Details
#accept(visitor) ⇒ Object
302 303 304 305 |
# File 'lib/taskinator/task.rb', line 302 def accept(visitor) super visitor.visit_process(:sub_process) end |
#enqueue ⇒ Object
282 283 284 |
# File 'lib/taskinator/task.rb', line 282 def enqueue sub_process.enqueue! end |
#incr_count? ⇒ Boolean
296 297 298 299 300 |
# File 'lib/taskinator/task.rb', line 296 def incr_count? # subprocess tasks aren't included in the total count of tasks # since they simply delegate to the tasks of the respective subprocess definition false end |
#inspect ⇒ Object
307 308 309 |
# File 'lib/taskinator/task.rb', line 307 def inspect %(#<#{self.class.name}:0x#{self.__id__.to_s(16)} uuid="#{uuid}", sub_process=#{sub_process.inspect}, current_state=:#{current_state}>) end |
#start ⇒ Object
286 287 288 289 290 291 292 293 294 |
# File 'lib/taskinator/task.rb', line 286 def start sub_process.start! rescue => e Taskinator.logger.error(e) Taskinator.logger.debug(e.backtrace) fail!(e) raise e end |