• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python runner._run_scenario_once函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中rally.task.runner._run_scenario_once函数的典型用法代码示例。如果您正苦于以下问题:Python _run_scenario_once函数的具体用法?Python _run_scenario_once怎么用?Python _run_scenario_once使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: test_run_scenario_once_internal_logic

    def test_run_scenario_once_internal_logic(self):
        context = runner._get_scenario_context(
            12, fakes.FakeContext({}).context)
        scenario_cls = mock.MagicMock()

        runner._run_scenario_once(scenario_cls, "test", context, {})

        expected_calls = [
            mock.call(context),
            mock.call().test(),
            mock.call().idle_duration(),
            mock.call().idle_duration(),
            mock.call().atomic_actions()
        ]
        scenario_cls.assert_has_calls(expected_calls, any_order=True)
开发者ID:gluke77,项目名称:rally,代码行数:15,代码来源:test_runner.py


示例2: _run_scenario

    def _run_scenario(self, cls, method_name, context, args):
        """Runs the specified scenario with given arguments.

        The scenario iterations are executed one-by-one in the same python
        interpreter process as Rally. This allows you to execute
        scenario without introducing any concurrent operations as well as
        interactively debug the scenario from the same command that you use
        to start Rally.

        :param cls: The Scenario class where the scenario is implemented
        :param method_name: Name of the method that implements the scenario
        :param context: context that contains users, admin & other
                        information, that was created before scenario
                        execution starts.
        :param args: Arguments to call the scenario method with

        :returns: List of results fore each single scenario iteration,
                  where each result is a dictionary
        """
        times = self.config.get("times", 1)

        event_queue = rutils.DequeAsQueue(self.event_queue)

        for i in range(times):
            if self.aborted.is_set():
                break
            result = runner._run_scenario_once(
                cls, method_name, runner._get_scenario_context(i, context),
                args, event_queue)
            self._send_result(result)

        self._flush_results()
开发者ID:andreykurilin,项目名称:rally,代码行数:32,代码来源:serial.py


示例3: _run_scenario_once_with_sleep

def _run_scenario_once_with_sleep(args):
    iteration, cls, method_name, context_obj, kwargs, pause = args

    # Time to take a break
    time.sleep(pause)
    args = (iteration, cls, method_name, context_obj, kwargs)
    return runner._run_scenario_once(args)
开发者ID:dkalashnik,项目名称:rally-mos-nodes-plugin,代码行数:7,代码来源:constant_with_break.py


示例4: _run_scenario_once_with_unpack_args

def _run_scenario_once_with_unpack_args(args):
    # NOTE(andreykurilin): `pool.imap` is used in
    #     ConstantForDurationScenarioRunner. It does not want to work with
    #     instance-methods, class-methods and static-methods. Also, it can't
    #     transmit positional or keyword arguments to destination function.
    #     While original `rally.task.runner._run_scenario_once` accepts
    #     multiple arguments instead of one big tuple with all arguments, we
    #     need to hardcode unpacking here(all other runners are able to
    #     transmit arguments in proper way).
    return runner._run_scenario_once(*args)
开发者ID:hameedullah,项目名称:rally,代码行数:10,代码来源:constant.py


示例5: _run_scenario

    def _run_scenario(self, cls, method_name, context, args):
        # runners settings are stored in self.config
        min_times = self.config.get("min_times", 1)
        max_times = self.config.get("max_times", 1)

        for i in range(random.randrange(min_times, max_times)):
            run_args = (i, cls, method_name,
                        runner._get_scenario_context(context), args)
            result = runner._run_scenario_once(run_args)
            # use self.send_result for result of each iteration
            self._send_result(result)
开发者ID:NaliniKrishna,项目名称:Rally,代码行数:11,代码来源:runner_plugin.py


示例6: test_run_scenario_once_internal_logic

    def test_run_scenario_once_internal_logic(self):
        context = runner._get_scenario_context(
            12, fakes.FakeContext({}).context)
        scenario_cls = mock.MagicMock()
        event_queue = mock.MagicMock()

        runner._run_scenario_once(
            scenario_cls, "test", context, {}, event_queue)

        expected_calls = [
            mock.call(context),
            mock.call().test(),
            mock.call().idle_duration(),
            mock.call().idle_duration(),
            mock.call().atomic_actions()
        ]
        scenario_cls.assert_has_calls(expected_calls, any_order=True)

        event_queue.put.assert_called_once_with(
            {"type": "iteration", "value": 13})
开发者ID:alinbalutoiu,项目名称:rally,代码行数:20,代码来源:test_runner.py


示例7: test_run_scenario_once_without_scenario_output

    def test_run_scenario_once_without_scenario_output(self, mock_timer):
        result = runner._run_scenario_once(
            fakes.FakeScenario, "do_it", mock.MagicMock(), {})

        expected_result = {
            "duration": fakes.FakeTimer().duration(),
            "timestamp": fakes.FakeTimer().timestamp(),
            "idle_duration": 0,
            "error": [],
            "output": {"additive": [], "complete": []},
            "atomic_actions": {}
        }
        self.assertEqual(expected_result, result)
开发者ID:gluke77,项目名称:rally,代码行数:13,代码来源:test_runner.py


示例8: test_run_scenario_once_without_scenario_output

    def test_run_scenario_once_without_scenario_output(self, mock_timer):
        args = (1, fakes.FakeScenario, "do_it", mock.MagicMock(), {})
        result = runner._run_scenario_once(args)

        expected_result = {
            "duration": fakes.FakeTimer().duration(),
            "timestamp": fakes.FakeTimer().timestamp(),
            "idle_duration": 0,
            "error": [],
            "scenario_output": {"errors": "", "data": {}},
            "atomic_actions": {}
        }
        self.assertEqual(expected_result, result)
开发者ID:Pigueiras,项目名称:rally,代码行数:13,代码来源:test_runner.py


示例9: test_run_scenario_once_exception

 def test_run_scenario_once_exception(self, mock_timer):
     result = runner._run_scenario_once(
         fakes.FakeScenario, "something_went_wrong", mock.MagicMock(), {})
     expected_error = result.pop("error")
     expected_result = {
         "duration": fakes.FakeTimer().duration(),
         "timestamp": fakes.FakeTimer().timestamp(),
         "idle_duration": 0,
         "output": {"additive": [], "complete": []},
         "atomic_actions": {}
     }
     self.assertEqual(expected_result, result)
     self.assertEqual(expected_error[:2],
                      ["Exception", "Something went wrong"])
开发者ID:gluke77,项目名称:rally,代码行数:14,代码来源:test_runner.py


示例10: test_run_scenario_once_with_scenario_output

    def test_run_scenario_once_with_scenario_output(self, mock_timer):
        context = runner._get_scenario_context(
            fakes.FakeUserContext({}).context)
        args = (1, fakes.FakeScenario, "with_output", context, {})
        result = runner._run_scenario_once(args)

        expected_result = {
            "duration": fakes.FakeTimer().duration(),
            "timestamp": fakes.FakeTimer().timestamp(),
            "idle_duration": 0,
            "error": [],
            "scenario_output": fakes.FakeScenario().with_output(),
            "atomic_actions": {}
        }
        self.assertEqual(expected_result, result)
开发者ID:sckevmit,项目名称:rally,代码行数:15,代码来源:test_runner.py


示例11: test_run_scenario_once_exception

 def test_run_scenario_once_exception(self, mock_timer):
     context = runner._get_scenario_context(
         fakes.FakeUserContext({}).context)
     args = (1, fakes.FakeScenario, "something_went_wrong", context, {})
     result = runner._run_scenario_once(args)
     expected_error = result.pop("error")
     expected_result = {
         "duration": fakes.FakeTimer().duration(),
         "timestamp": fakes.FakeTimer().timestamp(),
         "idle_duration": 0,
         "scenario_output": {"errors": "", "data": {}},
         "atomic_actions": {}
     }
     self.assertEqual(expected_result, result)
     self.assertEqual(expected_error[:2],
                      ["Exception", "Something went wrong"])
开发者ID:sckevmit,项目名称:rally,代码行数:16,代码来源:test_runner.py


示例12: test_run_scenario_once_with_returned_scenario_output

    def test_run_scenario_once_with_returned_scenario_output(self, mock_timer):
        args = (1, fakes.FakeScenario, "with_output", mock.MagicMock(), {})
        result = runner._run_scenario_once(args)

        expected_result = {
            "duration": fakes.FakeTimer().duration(),
            "timestamp": fakes.FakeTimer().timestamp(),
            "idle_duration": 0,
            "error": [],
            "output": {"additive": [{"chart_plugin": "StackedArea",
                                     "description": "",
                                     "data": [["a", 1]],
                                     "title": "Scenario output"}],
                       "complete": []},
            "atomic_actions": {}
        }
        self.assertEqual(expected_result, result)
开发者ID:amit0701,项目名称:rally,代码行数:17,代码来源:test_runner.py


示例13: test_run_scenario_once_with_added_scenario_output

    def test_run_scenario_once_with_added_scenario_output(self, mock_timer):
        result = runner._run_scenario_once(
            fakes.FakeScenario, "with_add_output", mock.MagicMock(), {})

        expected_result = {
            "duration": fakes.FakeTimer().duration(),
            "timestamp": fakes.FakeTimer().timestamp(),
            "idle_duration": 0,
            "error": [],
            "output": {"additive": [{"chart_plugin": "FooPlugin",
                                     "description": "Additive description",
                                     "data": [["a", 1]],
                                     "title": "Additive"}],
                       "complete": [{"data": [["a", [[1, 2], [2, 3]]]],
                                     "description": "Complete description",
                                     "title": "Complete",
                                     "chart_plugin": "BarPlugin"}]},
            "atomic_actions": {}
        }
        self.assertEqual(expected_result, result)
开发者ID:gluke77,项目名称:rally,代码行数:20,代码来源:test_runner.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utils.get_from_manager函数代码示例发布时间:2022-05-26
下一篇:
Python runner._get_scenario_context函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap