lib/dynflow/world/invalidation.rb
# Tries to load an execution plan using id stored in the
# lock. If the execution plan cannot be loaded or is invalid,
# the lock is released. If the plan gets loaded successfully, it
# is yielded to a given block.
#
# @param execution_lock [Coordinator::ExecutionLock] the lock for which we're trying
#   to load the execution plan
# @yieldparam [ExecutionPlan] execution_plan the successfully loaded execution plan
# @return [void]
Tries to load an execution plan using id stored in the
lock. If the execution plan cannot be loaded or is invalid,
the lock is released. If the plan gets loaded successfully, it
is yielded to a given block.
Tries to load an execution plan using id stored in the lock . If the execution plan cannot be loaded or is invalid the lock is released . If the plan gets loaded successfully it is yielded to a given block .
def with_valid_execution_plan_for_lock(execution_lock)
        begin
          plan = persistence.load_execution_plan(execution_lock.execution_plan_id)
        rescue => e
          if e.is_a?(KeyError)
            logger.error "invalidated execution plan #{execution_lock.execution_plan_id} missing, skipping"
          else
            logger.error e
            logger.error "unexpected error when invalidating execution plan #{execution_lock.execution_plan_id}, skipping"
          end
          coordinator.release(execution_lock)
          coordinator.release_by_owner(execution_lock.id)
          return
        end
        unless plan.valid?
          logger.error "invalid plan #{plan.id}, skipping"
          coordinator.release(execution_lock)
          coordinator.release_by_owner(execution_lock.id)
          return
        end
        yield plan
      end
def with_valid_execution_plan_for_lock ( execution_lock ) begin plan = persistence . load_execution_plan ( execution_lock . execution_plan_id ) rescue => e if e . is_a? ( KeyError ) logger . error "invalidated execution plan #{execution_lock.execution_plan_id} missing, skipping" else logger . error e logger . error "unexpected error when invalidating execution plan #{execution_lock.execution_plan_id}, skipping" end coordinator . release ( execution_lock ) coordinator . release_by_owner ( execution_lock . id ) return end unless plan . valid? logger . error "invalid plan #{plan.id}, skipping" coordinator . release ( execution_lock ) coordinator . release_by_owner ( execution_lock . id ) return end yield plan end
Tries to load an execution plan using id stored in the
lock.
Tries to load an execution plan using id stored in the lock .
None
void
execution_lock
the lock for which we're trying to load the execution plan
the lock for which we ' re trying to load the execution plan
execution_plan the successfully loaded execution plan
execution_plan the successfully loaded execution plan