当前位置: 首页>>代码示例>>Python>>正文


Python LiveActionDB.context方法代码示例

本文整理汇总了Python中st2common.models.db.liveaction.LiveActionDB.context方法的典型用法代码示例。如果您正苦于以下问题:Python LiveActionDB.context方法的具体用法?Python LiveActionDB.context怎么用?Python LiveActionDB.context使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在st2common.models.db.liveaction.LiveActionDB的用法示例。


在下文中一共展示了LiveActionDB.context方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _run_action

# 需要导入模块: from st2common.models.db.liveaction import LiveActionDB [as 别名]
# 或者: from st2common.models.db.liveaction.LiveActionDB import context [as 别名]
    def _run_action(self, action_node, parent_execution_id, params, wait_for_completion=True):
        liveaction = LiveActionDB(action=action_node.ref)
        liveaction.parameters = action_param_utils.cast_params(action_ref=action_node.ref,
                                                               params=params)

        # Setup notify for task in chain.
        notify = self._get_notify(action_node)
        if notify:
            liveaction.notify = notify
            LOG.debug('%s: Task notify set to: %s', action_node.name, liveaction.notify)

        liveaction.context = {
            'parent': str(parent_execution_id),
            'chain': vars(action_node)
        }

        liveaction, _ = action_service.request(liveaction)

        while (wait_for_completion and
               liveaction.status != LIVEACTION_STATUS_SUCCEEDED and
               liveaction.status != LIVEACTION_STATUS_FAILED):
            eventlet.sleep(1)
            liveaction = action_db_util.get_liveaction_by_id(liveaction.id)

        return liveaction
开发者ID:Kailashkatheth1,项目名称:st2,代码行数:27,代码来源:actionchainrunner.py

示例2: _get_liveaction_model

# 需要导入模块: from st2common.models.db.liveaction import LiveActionDB [as 别名]
# 或者: from st2common.models.db.liveaction.LiveActionDB import context [as 别名]
    def _get_liveaction_model(self, params):
        status = 'initializing'
        start_timestamp = date_utils.get_datetime_utc_now()
        action_ref = ResourceReference(name=ParamsUtilsTest.action_db.name,
                                       pack=ParamsUtilsTest.action_db.pack).ref
        liveaction_db = LiveActionDB(status=status, start_timestamp=start_timestamp,
                                     action=action_ref, parameters=params)
        liveaction_db.context = {'source_channel': 'awesome', 'api_user': 'noob'}

        return liveaction_db
开发者ID:ruslantum,项目名称:st2,代码行数:12,代码来源:test_param_utils.py

示例3: _get_failingaction_exec_db_model

# 需要导入模块: from st2common.models.db.liveaction import LiveActionDB [as 别名]
# 或者: from st2common.models.db.liveaction.LiveActionDB import context [as 别名]
 def _get_failingaction_exec_db_model(self, params):
     liveaction_db = LiveActionDB()
     liveaction_db.status = action_constants.LIVEACTION_STATUS_REQUESTED
     liveaction_db.start_timestamp = datetime.datetime.now()
     liveaction_db.action = ResourceReference(
         name=RunnerContainerTest.failingaction_db.name,
         pack=RunnerContainerTest.failingaction_db.pack).ref
     liveaction_db.parameters = params
     liveaction_db.context = {'user': cfg.CONF.system_user.user}
     return liveaction_db
开发者ID:Kailashkatheth1,项目名称:st2,代码行数:12,代码来源:test_runner_container.py

示例4: _get_action_exec_db_model

# 需要导入模块: from st2common.models.db.liveaction import LiveActionDB [as 别名]
# 或者: from st2common.models.db.liveaction.LiveActionDB import context [as 别名]
 def _get_action_exec_db_model(self, action_db, params):
     liveaction_db = LiveActionDB()
     liveaction_db.status = action_constants.LIVEACTION_STATUS_REQUESTED
     liveaction_db.start_timestamp = date_utils.get_datetime_utc_now()
     liveaction_db.action = ResourceReference(
         name=action_db.name,
         pack=action_db.pack).ref
     liveaction_db.parameters = params
     liveaction_db.context = {'user': cfg.CONF.system_user.user}
     return liveaction_db
开发者ID:ipv1337,项目名称:st2,代码行数:12,代码来源:test_runner_container.py

示例5: _build_liveaction_object

# 需要导入模块: from st2common.models.db.liveaction import LiveActionDB [as 别名]
# 或者: from st2common.models.db.liveaction.LiveActionDB import context [as 别名]
    def _build_liveaction_object(self, action_node, resolved_params, parent_context):
        liveaction = LiveActionDB(action=action_node.ref)

        # Setup notify for task in chain.
        notify = self._get_notify(action_node)
        if notify:
            liveaction.notify = notify
            LOG.debug('%s: Task notify set to: %s', action_node.name, liveaction.notify)

        liveaction.context = {
            'parent': parent_context,
            'chain': vars(action_node)
        }
        liveaction.parameters = action_param_utils.cast_params(action_ref=action_node.ref,
                                                               params=resolved_params)
        return liveaction
开发者ID:LindsayHill,项目名称:st2,代码行数:18,代码来源:action_chain_runner.py

示例6: _get_liveaction_model

# 需要导入模块: from st2common.models.db.liveaction import LiveActionDB [as 别名]
# 或者: from st2common.models.db.liveaction.LiveActionDB import context [as 别名]
    def _get_liveaction_model(self, params, with_config_context=False):
        status = 'initializing'
        start_timestamp = date_utils.get_datetime_utc_now()
        action_ref = ResourceReference(name=ParamsUtilsTest.action_db.name,
                                       pack=ParamsUtilsTest.action_db.pack).ref
        liveaction_db = LiveActionDB(status=status, start_timestamp=start_timestamp,
                                     action=action_ref, parameters=params)
        liveaction_db.context = {
            'api_user': 'noob',
            'source_channel': 'reddit',
        }

        if with_config_context:
            liveaction_db.context.update(
                {
                    'pack': 'generic',
                    'user': 'st2admin'
                }
            )

        return liveaction_db
开发者ID:lyandut,项目名称:st2,代码行数:23,代码来源:test_param_utils.py


注:本文中的st2common.models.db.liveaction.LiveActionDB.context方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。