lib/dynflow/world/invalidation.rb
# Invalidate an execution lock, left behind by a executor that
# was executing an execution plan when it was terminated.
#
# @param execution_lock [Coordinator::ExecutionLock] the lock to invalidate
# @return [void]
Invalidate an execution lock, left behind by a executor that
was executing an execution plan when it was terminated.
Invalidate an execution lock left behind by a executor that was executing an execution plan when it was terminated .
def invalidate_execution_lock(execution_lock)
        with_valid_execution_plan_for_lock(execution_lock) do |plan|
          plan.steps.values.each { |step| invalidate_step step }
          plan.execution_history.add('terminate execution', execution_lock.world_id)
          plan.update_state(:paused, history_notice: false) if plan.state == :running
          plan.save
          coordinator.release(execution_lock)
          if plan.error?
            new_state = plan.prepare_for_rescue
            execute(plan.id) if new_state == :running
          else
            if coordinator.find_worlds(true).any? 
              client_dispatcher.tell([:dispatch_request,
                                      Dispatcher::Execution[execution_lock.execution_plan_id],
                                      execution_lock.client_world_id,
                                      execution_lock.request_id])
            end
          end
        end
      rescue Errors::PersistenceError
        logger.error "failed to write data while invalidating execution lock #{execution_lock}"
      end
def invalidate_execution_lock ( execution_lock ) with_valid_execution_plan_for_lock ( execution_lock ) do | plan | plan . steps . values . each { | step | invalidate_step step } plan . execution_history . add ( 'terminate execution' , execution_lock . world_id ) plan . update_state ( :paused , history_notice : false ) if plan . state == :running plan . save coordinator . release ( execution_lock ) if plan . error? new_state = plan . prepare_for_rescue execute ( plan . id ) if new_state == :running else if coordinator . find_worlds ( true ) . any? client_dispatcher . tell ( [ :dispatch_request , Dispatcher :: Execution [ execution_lock . execution_plan_id ] , execution_lock . client_world_id , execution_lock . request_id ] ) end end end rescue Errors :: PersistenceError logger . error "failed to write data while invalidating execution lock #{execution_lock}" end
Invalidate an execution lock, left behind by a executor that
was executing an execution plan when it was terminated.
Invalidate an execution lock left behind by a executor that was executing an execution plan when it was terminated .
# Check if there are any executors
None
void
execution_lock
the lock to invalidate
the lock to invalidate