Merge "Fix missing watcher_workflow_engines.taskflow section"

This commit is contained in:
Zuul
2025-08-26 13:16:19 +00:00
committed by Gerrit Code Review
2 changed files with 9 additions and 7 deletions

View File

@@ -36,9 +36,6 @@ from watcher.objects import fields
LOG = log.getLogger(__name__)
CANCEL_STATE = [objects.action_plan.State.CANCELLING,
objects.action_plan.State.CANCELLED]
class BaseWorkFlowEngine(loadable.Loadable, metaclass=abc.ABCMeta):
@@ -162,7 +159,7 @@ class BaseTaskFlowActionContainer(flow_task.Task):
# so that taskflow does not schedule further actions.
action_plan = objects.ActionPlan.get_by_id(
self.engine.context, self._db_action.action_plan_id)
if action_plan.state in CANCEL_STATE:
if action_plan.state in objects.action_plan.State.CANCEL_STATES:
raise exception.ActionPlanCancelled(uuid=action_plan.uuid)
if self._db_action.state == objects.action.State.SKIPPED:
LOG.debug("Action %s is skipped manually",
@@ -245,7 +242,8 @@ class BaseTaskFlowActionContainer(flow_task.Task):
result = True
if (action_object.state in [objects.action.State.SUCCEEDED,
objects.action.State.FAILED] or
action_plan_object.state in CANCEL_STATE):
action_plan_object.state in
objects.action_plan.State.CANCEL_STATES):
break
time.sleep(1)
try:
@@ -255,7 +253,9 @@ class BaseTaskFlowActionContainer(flow_task.Task):
# Not all actions support abort operations, kill only those action
# which support abort operations
abort = self.action.check_abort()
if (action_plan_object.state in CANCEL_STATE and abort):
if (action_plan_object.state in
objects.action_plan.State.CANCEL_STATES and
abort):
et.kill()
et.wait()
return result
@@ -300,7 +300,7 @@ class BaseTaskFlowActionContainer(flow_task.Task):
# NOTE: check if revert cause by cancel action plan or
# some other exception occurred during action plan execution
# if due to some other exception keep the flow intact.
if action_plan.state not in CANCEL_STATE:
if action_plan.state not in objects.action_plan.State.CANCEL_STATES:
self.do_revert()
return

View File

@@ -98,6 +98,8 @@ class State(object):
SUPERSEDED = 'SUPERSEDED'
CANCELLING = 'CANCELLING'
CANCEL_STATES = [CANCELLING, CANCELLED]
@base.WatcherObjectRegistry.register
class ActionPlan(base.WatcherPersistentObject, base.WatcherObject,