Class: Dynflow::Director::WorkItem

Inherits:
Serializable show all
Defined in:
lib/dynflow/director.rb

Direct Known Subclasses

FinalizeWorkItem, PlanningWorkItem, StepWorkItem

Constant Summary

Constants inherited from Serializable

Serializable::LEGACY_TIME_FORMAT, Serializable::TIME_FORMAT

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Serializable

constantize, from_hash

Constructor Details

#initialize(execution_plan_id, queue, sender_orchestrator_id) ⇒ WorkItem

Returns a new instance of WorkItem.



28
29
30
31
32
# File 'lib/dynflow/director.rb', line 28

def initialize(execution_plan_id, queue, sender_orchestrator_id)
  @execution_plan_id = execution_plan_id
  @queue = queue
  @sender_orchestrator_id = sender_orchestrator_id
end

Instance Attribute Details

#execution_plan_idObject (readonly)

Returns the value of attribute execution_plan_id.



26
27
28
# File 'lib/dynflow/director.rb', line 26

def execution_plan_id
  @execution_plan_id
end

#queueObject (readonly)

Returns the value of attribute queue.



26
27
28
# File 'lib/dynflow/director.rb', line 26

def queue
  @queue
end

#sender_orchestrator_idObject (readonly)

Returns the value of attribute sender_orchestrator_id.



26
27
28
# File 'lib/dynflow/director.rb', line 26

def sender_orchestrator_id
  @sender_orchestrator_id
end

Class Method Details

.new_from_hash(hash, *_args) ⇒ Object



56
57
58
# File 'lib/dynflow/director.rb', line 56

def self.new_from_hash(hash, *_args)
  self.new(hash[:execution_plan_id], hash[:queue], hash[:sender_orchestrator_id])
end

Instance Method Details

#executeObject

Raises:

  • (NotImplementedError)


45
46
47
# File 'lib/dynflow/director.rb', line 45

def execute
  raise NotImplementedError
end

#to_hashObject



49
50
51
52
53
54
# File 'lib/dynflow/director.rb', line 49

def to_hash
  { class: self.class.name,
    execution_plan_id: execution_plan_id,
    queue: queue,
    sender_orchestrator_id: sender_orchestrator_id }
end

#worldObject



34
35
36
37
# File 'lib/dynflow/director.rb', line 34

def world
  raise "World expected but not set for the work item #{self}" unless @world
  @world
end

#world=(world) ⇒ Object

the world to be used for execution purposes of the step. Setting it separately and explicitly as the world can’t be serialized



41
42
43
# File 'lib/dynflow/director.rb', line 41

def world=(world)
  @world = world
end