Class: Dynflow::Director::PlanningWorkItem

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

Constant Summary

Constants inherited from Serializable

Serializable::LEGACY_TIME_FORMAT, Serializable::TIME_FORMAT

Instance Attribute Summary

Attributes inherited from WorkItem

#execution_plan_id, #queue, #sender_orchestrator_id

Instance Method Summary collapse

Methods inherited from WorkItem

#initialize, new_from_hash, #to_hash, #world, #world=

Methods inherited from Serializable

constantize, from_hash, new_from_hash, #to_hash

Constructor Details

This class inherits a constructor from Dynflow::Director::WorkItem

Instance Method Details

#executeObject



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/dynflow/director.rb', line 113

def execute
  plan = world.persistence.load_delayed_plan(execution_plan_id)
  return if plan.nil? || plan.execution_plan.state != :scheduled

  if !plan.start_before.nil? && plan.start_before < Time.now.utc()
    plan.timeout
    return
  end

  world.coordinator.acquire(Coordinator::PlanningLock.new(world, plan.execution_plan_uuid)) do
    plan.plan
  end
  plan.execute
rescue => e
  world.logger.warn e.message
  world.logger.debug e.backtrace.join("\n")
end