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

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

Instance Attribute Summary

Attributes inherited from Abstract

#action_class, #action_id, #ended_at, #error, #execution_plan_id, #execution_time, #id, #progress_weight, #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



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

def self.state_transitions
  @state_transitions ||= {
      pending:   [:running, :skipped], # :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)


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

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

#mark_to_skipObject



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/dynflow/execution_plan/steps/run_step.rb', line 26

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



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

def phase
  Action::Run
end