Sha256: 6425632866ef14deeee8ddf23718e3bea141ebe1b253771e0a21a22eeb6e85ef

Contents?: true

Size: 1.21 KB

Versions: 21

Compression:

Stored size: 1.21 KB

Contents

module Dynflow
  module ExecutionPlan::Steps
    class RunStep < AbstractFlowStep

      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

      def phase
        Action::Run
      end

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

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

      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
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
dynflow-0.8.37 lib/dynflow/execution_plan/steps/run_step.rb
dynflow-0.8.36 lib/dynflow/execution_plan/steps/run_step.rb
dynflow-0.8.35 lib/dynflow/execution_plan/steps/run_step.rb
dynflow-0.8.34 lib/dynflow/execution_plan/steps/run_step.rb
dynflow-0.8.33 lib/dynflow/execution_plan/steps/run_step.rb
dynflow-0.8.32 lib/dynflow/execution_plan/steps/run_step.rb
dynflow-0.8.31 lib/dynflow/execution_plan/steps/run_step.rb
dynflow-0.8.30 lib/dynflow/execution_plan/steps/run_step.rb
dynflow-0.8.29 lib/dynflow/execution_plan/steps/run_step.rb
dynflow-0.8.28 lib/dynflow/execution_plan/steps/run_step.rb
dynflow-0.8.27 lib/dynflow/execution_plan/steps/run_step.rb
dynflow-0.8.26 lib/dynflow/execution_plan/steps/run_step.rb
dynflow-0.8.25 lib/dynflow/execution_plan/steps/run_step.rb
dynflow-0.8.24 lib/dynflow/execution_plan/steps/run_step.rb
dynflow-0.8.23 lib/dynflow/execution_plan/steps/run_step.rb
dynflow-0.8.22 lib/dynflow/execution_plan/steps/run_step.rb
dynflow-0.8.21 lib/dynflow/execution_plan/steps/run_step.rb
dynflow-0.8.20 lib/dynflow/execution_plan/steps/run_step.rb
dynflow-0.8.19 lib/dynflow/execution_plan/steps/run_step.rb
dynflow-0.8.18 lib/dynflow/execution_plan/steps/run_step.rb