Class: Taskinator::Process::Sequential
- Inherits:
-
Taskinator::Process
- Object
- Taskinator::Process
- Taskinator::Process::Sequential
- Defined in:
- lib/taskinator/process.rb
Overview
Instance Attribute Summary
Attributes inherited from Taskinator::Process
#created_at, #definition, #options, #parent, #queue, #scope, #updated_at, #uuid
Instance Method Summary collapse
Methods inherited from Taskinator::Process
#<=>, #accept, #cancel!, #complete!, define_concurrent_process_for, define_sequential_process_for, #enqueue!, #fail!, #initialize, #no_tasks_defined?, #pause!, #resume!, #start!, #task_failed, #tasks, #tasks_completed?, #to_s
Methods included from Instrumentation
#cancelled_payload, #completed_payload, #enqueued_payload, #failed_payload, #instrument, #paused_payload, #processing_payload, #resumed_payload
Methods included from Taskinator::Persistence
add_process_to_list, deserialize, included, processes_list_key, serialize
Methods included from Workflow
#current_state, #current_state=, #transition
Constructor Details
This class inherits a constructor from Taskinator::Process
Instance Method Details
#enqueue ⇒ Object
190 191 192 193 194 195 196 |
# File 'lib/taskinator/process.rb', line 190 def enqueue if tasks.empty? complete! # weren't any tasks to start with else tasks.first.enqueue! end end |
#inspect ⇒ Object
221 222 223 |
# File 'lib/taskinator/process.rb', line 221 def inspect %(#<#{self.class.name}:0x#{self.__id__.to_s(16)} uuid="#{uuid}", state=:#{current_state}, tasks=[#{tasks.inspect}]>) end |
#start ⇒ Object
198 199 200 201 202 203 204 205 |
# File 'lib/taskinator/process.rb', line 198 def start task = tasks.first if task task.start! else complete! # weren't any tasks to start with end end |
#task_completed(task) ⇒ Object
207 208 209 210 211 212 213 214 215 216 217 218 219 |
# File 'lib/taskinator/process.rb', line 207 def task_completed(task) # decrement the count of pending sequential tasks pending = deincr_pending_tasks Taskinator.logger.info("Completed task for process '#{uuid}'. Pending is #{pending}.") next_task = task.next if next_task next_task.enqueue! else complete! # aren't any more tasks end end |