Sha256: 378f059c27cb153e7f60778a0f83e6e621183266795ab57cc1089ea7dfcf0779

Contents?: true

Size: 1.35 KB

Versions: 25

Compression:

Stored size: 1.35 KB

Contents

# frozen_string_literal: true
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 update_from_action(action)
        super
        self.progress_weight = action.run_progress_weight
      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

25 entries across 25 versions & 1 rubygems

Version Path
dynflow-1.8.2 lib/dynflow/execution_plan/steps/run_step.rb
dynflow-1.8.1 lib/dynflow/execution_plan/steps/run_step.rb
dynflow-1.8.0 lib/dynflow/execution_plan/steps/run_step.rb
dynflow-1.7.0 lib/dynflow/execution_plan/steps/run_step.rb
dynflow-1.6.11 lib/dynflow/execution_plan/steps/run_step.rb
dynflow-1.6.10 lib/dynflow/execution_plan/steps/run_step.rb
dynflow-1.6.8 lib/dynflow/execution_plan/steps/run_step.rb
dynflow-1.6.7 lib/dynflow/execution_plan/steps/run_step.rb
dynflow-1.6.6 lib/dynflow/execution_plan/steps/run_step.rb
dynflow-1.6.5 lib/dynflow/execution_plan/steps/run_step.rb
dynflow-1.6.4 lib/dynflow/execution_plan/steps/run_step.rb
dynflow-1.6.3 lib/dynflow/execution_plan/steps/run_step.rb
dynflow-1.6.2 lib/dynflow/execution_plan/steps/run_step.rb
dynflow-1.6.1 lib/dynflow/execution_plan/steps/run_step.rb
dynflow-1.4.9 lib/dynflow/execution_plan/steps/run_step.rb
dynflow-1.4.8 lib/dynflow/execution_plan/steps/run_step.rb
dynflow-1.5.0 lib/dynflow/execution_plan/steps/run_step.rb
dynflow-1.4.7 lib/dynflow/execution_plan/steps/run_step.rb
dynflow-1.4.6 lib/dynflow/execution_plan/steps/run_step.rb
dynflow-1.4.5 lib/dynflow/execution_plan/steps/run_step.rb