Class: Dynflow::ExecutionPlan::Steps::RunStep

Inherits:
AbstractFlowStep show all
Defined in:
lib/dynflow/execution_plan/steps/run_step.rb

Constant Summary

Constants inherited from Serializable

Serializable::LEGACY_TIME_FORMAT, Serializable::TIME_FORMAT

Instance Attribute Summary

Attributes inherited from Abstract

#action_class, #action_id, #delayed_events, #ended_at, #error, #execution_plan_id, #execution_time, #id, #progress_weight, #queue, #real_time, #started_at, #state, #world

Attributes included from Stateful

#state

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractFlowStep

#clone, #execute

Methods inherited from Abstract

#==, #action, #action_logger, #default_progress_done, #execute, #initialize, #persistence, #progress_done, #save, #skippable?, states, #to_hash, #to_s

Methods included from Stateful

included, #set_state, #state_transitions, #states

Methods inherited from Serializable

constantize, from_hash, new_from_hash, #to_hash

Constructor Details

This class inherits a constructor from Dynflow::ExecutionPlan::Steps::Abstract

Class Method Details

.state_transitionsObject



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/dynflow/execution_plan/steps/run_step.rb', line 6

def self.state_transitions
  @state_transitions ||= {
      pending:   [:running, :skipped, :error], # :skipped when it cannot be run because it depends on skipping step
      running:   [:success, :error, :suspended],
      success:   [:suspended], # after not-done process_update
      suspended: [:running, :error], # process_update, e.g. error in setup_progress_updates
      skipping:  [:error, :skipped], # waiting for the skip method to be called
      skipped:   [],
      error:     [:skipping, :running]
  }
end

Instance Method Details

#cancellable?Boolean

Returns:

  • (Boolean)


27
28
29
30
# File 'lib/dynflow/execution_plan/steps/run_step.rb', line 27

def cancellable?
  [:suspended, :running].include?(self.state) &&
    self.action_class < Action::Cancellable
end

#mark_to_skipObject



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/dynflow/execution_plan/steps/run_step.rb', line 36

def mark_to_skip
  case self.state
  when :error
    self.state = :skipping
  when :pending
    self.state = :skipped
  else
    raise "Skipping step in #{self.state} is not supported"
  end
  self.save
end

#phaseObject



23
24
25
# File 'lib/dynflow/execution_plan/steps/run_step.rb', line 23

def phase
  Action::Run
end

#update_from_action(action) ⇒ Object



18
19
20
21
# File 'lib/dynflow/execution_plan/steps/run_step.rb', line 18

def update_from_action(action)
  super
  self.progress_weight = action.run_progress_weight
end

#with_sub_plans?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/dynflow/execution_plan/steps/run_step.rb', line 32

def with_sub_plans?
  self.action_class < Action::WithSubPlans
end