Class: Taskinator::Task::SubProcess

Inherits:
Taskinator::Task show all
Defined in:
lib/taskinator/task.rb

Overview

a task which delegates to another process

Instance Attribute Summary collapse

Attributes inherited from Taskinator::Task

#next, #options, #process, #uuid

Instance Method Summary collapse

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?, #to_s

Methods included from Persistence

add_process_to_list, included, list_key

Constructor Details

#initialize(process, sub_process, options = {}) ⇒ SubProcess

Returns a new instance of SubProcess.

Raises:

  • (ArgumentError)


210
211
212
213
214
215
216
# File 'lib/taskinator/task.rb', line 210

def initialize(process, sub_process, options={})
  super(process, options)
  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_processObject (readonly)

Returns the value of attribute sub_process.



208
209
210
# File 'lib/taskinator/task.rb', line 208

def sub_process
  @sub_process
end

Instance Method Details

#accept(visitor) ⇒ Object



227
228
229
230
# File 'lib/taskinator/task.rb', line 227

def accept(visitor)
  super
  visitor.visit_process(:sub_process)
end

#can_complete_task?Boolean

Returns:

  • (Boolean)


222
223
224
225
# File 'lib/taskinator/task.rb', line 222

def can_complete_task?
  # NOTE: this works out-of-process, so there isn't any issue
  sub_process.completed?
end

#startObject



218
219
220
# File 'lib/taskinator/task.rb', line 218

def start
  sub_process.start!
end