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


Python Build.execute_next_subjob_or_teardown_slave方法代码示例

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


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

示例1: test_execute_next_subjob_with_empty_queue_cant_teardown_same_slave_twice

# 需要导入模块: from app.master.build import Build [as 别名]
# 或者: from app.master.build.Build import execute_next_subjob_or_teardown_slave [as 别名]
    def test_execute_next_subjob_with_empty_queue_cant_teardown_same_slave_twice(self):
        build = Build(BuildRequest({}))
        build._unstarted_subjobs = Queue()
        slave = Mock()
        slave.free_executor = Mock(return_value=0)
        build._slaves_allocated.append(slave)

        build.execute_next_subjob_or_teardown_slave(slave)
        build.execute_next_subjob_or_teardown_slave(slave)

        self.assertEqual(slave.teardown.call_count, 1, "Teardown should only be called once")
开发者ID:dncarley,项目名称:ClusterRunner,代码行数:13,代码来源:test_build.py

示例2: test_teardown_called_on_slave_when_no_subjobs_remain

# 需要导入模块: from app.master.build import Build [as 别名]
# 或者: from app.master.build.Build import execute_next_subjob_or_teardown_slave [as 别名]
    def test_teardown_called_on_slave_when_no_subjobs_remain(self):
        build = Build(BuildRequest({}))
        slave = Slave('', 1)
        slave.teardown = MagicMock()
        slave.free_executor = MagicMock(return_value=0)
        build._unstarted_subjobs = Queue()
        build._slaves_allocated = [slave]

        build.execute_next_subjob_or_teardown_slave(slave)

        slave.teardown.assert_called_with()
开发者ID:dncarley,项目名称:ClusterRunner,代码行数:13,代码来源:test_build.py

示例3: test_teardown_called_on_slave_when_slave_in_shutdown_mode

# 需要导入模块: from app.master.build import Build [as 别名]
# 或者: from app.master.build.Build import execute_next_subjob_or_teardown_slave [as 别名]
    def test_teardown_called_on_slave_when_slave_in_shutdown_mode(self):
        build = Build(BuildRequest({}))
        slave = Slave('', 1)
        slave.teardown = MagicMock()
        slave._is_in_shutdown_mode = True
        slave.free_executor = MagicMock(return_value=0)
        build._unstarted_subjobs = Queue()
        build._unstarted_subjobs.put(Mock(spec=Subjob))
        build._slaves_allocated = [slave]

        build.execute_next_subjob_or_teardown_slave(slave)

        slave.teardown.assert_called_with()
开发者ID:dncarley,项目名称:ClusterRunner,代码行数:15,代码来源:test_build.py

示例4: test_build_doesnt_use_more_than_max_executors_per_slave

# 需要导入模块: from app.master.build import Build [as 别名]
# 或者: from app.master.build.Build import execute_next_subjob_or_teardown_slave [as 别名]
    def test_build_doesnt_use_more_than_max_executors_per_slave(self):
        subjobs = self._create_subjobs()
        mock_project_type = self._create_mock_project_type()
        fake_setup_command = 'mock command'
        mock_slaves = [self._create_mock_slave(num_executors=5) for _ in range(3)]
        max_executors_per_slave = 2
        expected_total_num_executors_used = 6  # We expect the build to use 2 executors on each of the 3 slaves.

        build = Build(BuildRequest({'setup': fake_setup_command}))
        build._project_type = mock_project_type
        build.execute_next_subjob_or_teardown_slave = MagicMock()

        build.prepare(subjobs, self._create_job_config(max_executors_per_slave=max_executors_per_slave))
        [build.allocate_slave(mock_slave) for mock_slave in mock_slaves]

        expected_current_num_executors_used = 0
        for i in range(len(mock_slaves)):
            build.begin_subjob_executions_on_slave(mock_slaves[i])
            expected_current_num_executors_used += max_executors_per_slave
            self.assertEqual(
                build.execute_next_subjob_or_teardown_slave.call_count, expected_current_num_executors_used,
                'After allocating {} slaves, build with max_executors_per_slave set to {} should only be using {} '
                'executors.'.format(i + 1, max_executors_per_slave, expected_current_num_executors_used))

        self.assertEqual(
            build.execute_next_subjob_or_teardown_slave.call_count, expected_total_num_executors_used,
            'Build should start executing as many subjobs per slave as its max_executors_per_slave setting.')
开发者ID:dncarley,项目名称:ClusterRunner,代码行数:29,代码来源:test_build.py

示例5: test_build_doesnt_use_more_than_max_executors

# 需要导入模块: from app.master.build import Build [as 别名]
# 或者: from app.master.build.Build import execute_next_subjob_or_teardown_slave [as 别名]
    def test_build_doesnt_use_more_than_max_executors(self):
        subjobs = self._create_subjobs()
        mock_project_type = self._create_mock_project_type()
        fake_setup_command = 'mock command'
        mock_slaves = [self._create_mock_slave(num_executors=5) for _ in range(3)]
        expected_num_executors = 12  # We expect the build to use 12 out of 15 available executors.

        build = Build(BuildRequest({'setup': fake_setup_command}))
        build._project_type = mock_project_type
        build.execute_next_subjob_or_teardown_slave = MagicMock()

        build.prepare(subjobs, self._create_job_config(max_executors=expected_num_executors))
        [build.allocate_slave(mock_slave) for mock_slave in mock_slaves]
        [build.begin_subjob_executions_on_slave(mock_slave) for mock_slave in mock_slaves]

        self.assertEqual(build.execute_next_subjob_or_teardown_slave.call_count, expected_num_executors,
                         'Build should start executing as many subjobs as its max_executors setting.')
开发者ID:dncarley,项目名称:ClusterRunner,代码行数:19,代码来源:test_build.py


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