本文整理汇总了Python中app.master.build.Build.begin_subjob_executions_on_slave方法的典型用法代码示例。如果您正苦于以下问题:Python Build.begin_subjob_executions_on_slave方法的具体用法?Python Build.begin_subjob_executions_on_slave怎么用?Python Build.begin_subjob_executions_on_slave使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app.master.build.Build
的用法示例。
在下文中一共展示了Build.begin_subjob_executions_on_slave方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_build_doesnt_use_more_than_max_executors_per_slave
# 需要导入模块: from app.master.build import Build [as 别名]
# 或者: from app.master.build.Build import begin_subjob_executions_on_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.')
示例2: test_build_status_returns_building_after_setup_is_complete_and_subjobs_are_executing
# 需要导入模块: from app.master.build import Build [as 别名]
# 或者: from app.master.build.Build import begin_subjob_executions_on_slave [as 别名]
def test_build_status_returns_building_after_setup_is_complete_and_subjobs_are_executing(self):
subjobs = self._create_subjobs(count=3)
mock_project_type = self._create_mock_project_type()
mock_slave = self._create_mock_slave(num_executors=2)
build = Build(BuildRequest({}))
build._project_type = mock_project_type
build.prepare(subjobs, self._create_job_config())
build.allocate_slave(mock_slave)
build.begin_subjob_executions_on_slave(mock_slave) # two out of three subjobs are now in progress
self.assertEqual(build._status(), BuildStatus.BUILDING,
'Build status should be BUILDING after subjobs have started executing on slaves.')
示例3: test_build_doesnt_use_more_than_max_executors
# 需要导入模块: from app.master.build import Build [as 别名]
# 或者: from app.master.build.Build import begin_subjob_executions_on_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.')