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.



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

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.



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

def execution_plan_id
  @execution_plan_id
end

#queueObject (readonly)

Returns the value of attribute queue.



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

def queue
  @queue
end

#sender_orchestrator_idObject (readonly)

Returns the value of attribute sender_orchestrator_id.



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

def sender_orchestrator_id
  @sender_orchestrator_id
end

Class Method Details

.new_from_hash(hash, *_args) ⇒ Object



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

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)


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

def execute
  raise NotImplementedError
end

#to_hashObject



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

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

#worldObject



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

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



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

def world=(world)
  @world = world
end