from st2common.transport import workflow __all__ = [ 'ACTIONSCHEDULER_REQUEST_QUEUE', 'ACTIONRUNNER_WORK_QUEUE', 'ACTIONRUNNER_CANCEL_QUEUE', 'ACTIONRUNNER_PAUSE_QUEUE', 'ACTIONRUNNER_RESUME_QUEUE', 'EXPORTER_WORK_QUEUE', 'NOTIFIER_ACTIONUPDATE_WORK_QUEUE', 'RESULTSTRACKER_ACTIONSTATE_WORK_QUEUE', 'RULESENGINE_WORK_QUEUE', 'STREAM_ANNOUNCEMENT_WORK_QUEUE', 'STREAM_EXECUTION_ALL_WORK_QUEUE', 'STREAM_EXECUTION_UPDATE_WORK_QUEUE', 'STREAM_LIVEACTION_WORK_QUEUE', 'WORKFLOW_EXECUTION_WORK_QUEUE', 'WORKFLOW_EXECUTION_RESUME_QUEUE' ] # Used by the action scheduler service ACTIONSCHEDULER_REQUEST_QUEUE = liveaction.get_status_management_queue( 'st2.actionrunner.req', routing_key=action_constants.LIVEACTION_STATUS_REQUESTED) # Used by the action runner service ACTIONRUNNER_WORK_QUEUE = liveaction.get_status_management_queue( 'st2.actionrunner.work', routing_key=action_constants.LIVEACTION_STATUS_SCHEDULED) ACTIONRUNNER_CANCEL_QUEUE = liveaction.get_status_management_queue( 'st2.actionrunner.cancel', routing_key=action_constants.LIVEACTION_STATUS_CANCELING) ACTIONRUNNER_PAUSE_QUEUE = liveaction.get_status_management_queue( 'st2.actionrunner.pause', routing_key=action_constants.LIVEACTION_STATUS_PAUSING)
from kombu import Connection from oslo.config import cfg from st2common import log as logging from st2common.constants import action as action_constants from st2common.exceptions.db import StackStormDBObjectNotFoundError from st2common.models.db.liveaction import LiveActionDB from st2common.services import executions from st2common.persistence.liveaction import LiveAction from st2common.transport import consumers, liveaction from st2common.util import action_db as action_utils LOG = logging.getLogger(__name__) ACTIONRUNNER_REQUEST_Q = liveaction.get_status_management_queue( 'st2.actionrunner.req', routing_key=action_constants.LIVEACTION_STATUS_REQUESTED) class ActionExecutionScheduler(consumers.MessageHandler): message_type = LiveActionDB def process(self, request): """Schedules the LiveAction and publishes the request to the appropriate action runner(s). LiveAction in statuses other than "requested" are ignored. :param request: Action execution request. :type request: ``st2common.models.db.liveaction.LiveActionDB`` """
from st2actions.container.base import RunnerContainer from st2common import log as logging from st2common.constants import action as action_constants from st2common.exceptions.actionrunner import ActionRunnerException from st2common.exceptions.db import StackStormDBObjectNotFoundError from st2common.models.db.liveaction import LiveActionDB from st2common.services import executions from st2common.transport import consumers, liveaction from st2common.util import action_db as action_utils from st2common.util import system_info LOG = logging.getLogger(__name__) ACTIONRUNNER_WORK_Q = liveaction.get_status_management_queue( 'st2.actionrunner.work', routing_key=action_constants.LIVEACTION_STATUS_SCHEDULED) class ActionExecutionDispatcher(consumers.MessageHandler): message_type = LiveActionDB def __init__(self, connection, queues): super(ActionExecutionDispatcher, self).__init__(connection, queues) self.container = RunnerContainer() def process(self, liveaction): """Dispatches the LiveAction to appropriate action runner. LiveAction in statuses other than "scheduled" are ignored. If LiveAction is already canceled and result is empty, the LiveAction is updated with a generic exception message.
from st2common.exceptions.db import StackStormDBObjectNotFoundError from st2common.models.db.liveaction import LiveActionDB from st2common.persistence.execution import ActionExecution from st2common.services import executions from st2common.transport import liveaction from st2common.transport.consumers import MessageHandler from st2common.transport.consumers import ActionsQueueConsumer from st2common.transport import utils as transport_utils from st2common.util import action_db as action_utils from st2common.util import system_info LOG = logging.getLogger(__name__) ACTIONRUNNER_WORK_Q = liveaction.get_status_management_queue( "st2.actionrunner.work", routing_key=action_constants.LIVEACTION_STATUS_SCHEDULED ) ACTIONRUNNER_CANCEL_Q = liveaction.get_status_management_queue( "st2.actionrunner.canel", routing_key=action_constants.LIVEACTION_STATUS_CANCELING ) class ActionExecutionDispatcher(MessageHandler): message_type = LiveActionDB def __init__(self, connection, queues): super(ActionExecutionDispatcher, self).__init__(connection, queues) self.container = RunnerContainer() self._running_liveactions = set()
'RULESENGINE_WORK_QUEUE', 'STREAM_ANNOUNCEMENT_WORK_QUEUE', 'STREAM_EXECUTION_ALL_WORK_QUEUE', 'STREAM_EXECUTION_UPDATE_WORK_QUEUE', 'STREAM_LIVEACTION_WORK_QUEUE', 'WORKFLOW_EXECUTION_WORK_QUEUE', 'WORKFLOW_EXECUTION_RESUME_QUEUE' ] # Used by the action scheduler service ACTIONSCHEDULER_REQUEST_QUEUE = liveaction.get_status_management_queue( 'st2.actionrunner.req', routing_key=action_constants.LIVEACTION_STATUS_REQUESTED) # Used by the action runner service ACTIONRUNNER_WORK_QUEUE = liveaction.get_status_management_queue( 'st2.actionrunner.work', routing_key=action_constants.LIVEACTION_STATUS_SCHEDULED) ACTIONRUNNER_CANCEL_QUEUE = liveaction.get_status_management_queue( 'st2.actionrunner.cancel', routing_key=action_constants.LIVEACTION_STATUS_CANCELING) ACTIONRUNNER_PAUSE_QUEUE = liveaction.get_status_management_queue( 'st2.actionrunner.pause', routing_key=action_constants.LIVEACTION_STATUS_PAUSING)
from st2common.constants import action as action_constants from st2common.exceptions.db import StackStormDBObjectNotFoundError from st2common.models.db.liveaction import LiveActionDB from st2common.services import action as action_service from st2common.services import coordination from st2common.persistence.liveaction import LiveAction from st2common.persistence.policy import Policy from st2common import policies from st2common.transport import consumers, liveaction from st2common.util import action_db as action_utils from st2common.util import date as date_utils LOG = logging.getLogger(__name__) ACTIONRUNNER_REQUEST_Q = liveaction.get_status_management_queue( 'st2.actionrunner.req', routing_key=action_constants.LIVEACTION_STATUS_REQUESTED) class ActionExecutionScheduler(consumers.MessageHandler): message_type = LiveActionDB def process(self, request): """Schedules the LiveAction and publishes the request to the appropriate action runner(s). LiveAction in statuses other than "requested" are ignored. :param request: Action execution request. :type request: ``st2common.models.db.liveaction.LiveActionDB`` """