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


Python Build.build_id方法代码示例

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


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

示例1: handle_request_for_new_build

# 需要导入模块: from app.master.build import Build [as 别名]
# 或者: from app.master.build.Build import build_id [as 别名]
    def handle_request_for_new_build(self, build_params):
        """
        Creates a new Build object and adds it to the request queue to be processed.

        :param build_params:
        :type build_params: dict[str, str]
        :rtype tuple [bool, dict [str, str]]
        """
        build_request = BuildRequest(build_params)
        success = False

        if build_request.is_valid():
            build = Build(build_request)
            self._all_builds_by_id[build.build_id()] = build
            build.generate_project_type()  # WIP(joey): This should be internal to the Build object.
            self._build_request_handler.handle_build_request(build)
            response = {'build_id': build.build_id()}
            success = True
        elif not build_request.is_valid_type():
            response = {'error': 'Invalid build request type.'}
        else:
            required_params = build_request.required_parameters()
            response = {'error': 'Missing required parameter. Required parameters: {}'.format(required_params)}

        return success, response  # todo: refactor to use exception instead of boolean
开发者ID:fengshao0907,项目名称:ClusterRunner,代码行数:27,代码来源:cluster_master.py

示例2: handle_request_for_new_build

# 需要导入模块: from app.master.build import Build [as 别名]
# 或者: from app.master.build.Build import build_id [as 别名]
    def handle_request_for_new_build(self, build_params):
        """
        Creates a new Build object and adds it to the request queue to be processed.

        :param build_params:
        :type build_params: dict[str, str]
        :rtype tuple [bool, dict [str, str]]
        """
        build_request = BuildRequest(build_params)

        success = False
        if build_request.is_valid():
            build = Build(build_request)
            self._all_builds_by_id[build.build_id()] = build
            self._request_queue.put(build)
            analytics.record_event(analytics.BUILD_REQUEST_QUEUED, build_id=build.build_id())
            response = {'build_id': build.build_id()}
            success = True

        elif not build_request.is_valid_type():
            response = {'error': 'Invalid build request type.'}

        else:
            required_params = build_request.required_parameters()
            response = {'error': 'Missing required parameter. Required parameters: {}'.format(required_params)}

        return success, response
开发者ID:drobertduke,项目名称:ClusterRunner,代码行数:29,代码来源:cluster_master.py

示例3: setup

# 需要导入模块: from app.master.build import Build [as 别名]
# 或者: from app.master.build.Build import build_id [as 别名]
    def setup(self, build: Build, executor_start_index: int) -> bool:
        """
        Execute a setup command on the slave for the specified build. The setup process executes asynchronously on the
        slave and the slave will alert the master when setup is complete and it is ready to start working on subjobs.

        :param build: The build to set up this slave to work on
        :param executor_start_index: The index the slave should number its executors from for this build
        :return: Whether or not the call to start setup on the slave was successful
        """
        slave_project_type_params = build.build_request.build_parameters().copy()
        slave_project_type_params.update(build.project_type.slave_param_overrides())

        setup_url = self._slave_api.url('build', build.build_id(), 'setup')
        post_data = {
            'project_type_params': slave_project_type_params,
            'build_executor_start_index': executor_start_index,
        }

        self.current_build_id = build.build_id()
        try:
            self._network.post_with_digest(setup_url, post_data, Secret.get())
        except (requests.ConnectionError, requests.Timeout) as ex:
            self._logger.warning('Setup call to {} failed with {}: {}.', self, ex.__class__.__name__, str(ex))
            self.mark_dead()
            return False
        return True
开发者ID:box,项目名称:ClusterRunner,代码行数:28,代码来源:slave.py

示例4: test_exception_is_raised_if_problem_occurs_writing_subjob

# 需要导入模块: from app.master.build import Build [as 别名]
# 或者: from app.master.build.Build import build_id [as 别名]
    def test_exception_is_raised_if_problem_occurs_writing_subjob(self):
        Configuration['results_directory'] = abspath(join('some', 'temp', 'directory'))
        build = Build(BuildRequest({}))
        build._project_type = self._create_mock_project_type()
        subjob = self._create_subjobs(count=1, build_id=build.build_id())[0]
        build.prepare([subjob], self._create_job_config())
        self.mock_fs.write_file.side_effect = FileExistsError

        with self.assertRaises(Exception):
            payload = {'filename': 'turtles.txt', 'body': 'Heroes in a half shell.'}
            build.complete_subjob(subjob.subjob_id(), payload=payload)
开发者ID:dncarley,项目名称:ClusterRunner,代码行数:13,代码来源:test_build.py

示例5: test_complete_subjob_writes_and_extracts_payload_to_correct_directory

# 需要导入模块: from app.master.build import Build [as 别名]
# 或者: from app.master.build.Build import build_id [as 别名]
    def test_complete_subjob_writes_and_extracts_payload_to_correct_directory(self):
        Configuration['results_directory'] = '/tmp/results'
        build = Build(BuildRequest({}))
        build._project_type = self._create_mock_project_type()
        subjob = self._create_subjobs(count=1, build_id=build.build_id())[0]
        build.prepare([subjob], self._create_job_config())

        payload = {'filename': 'turtles.txt', 'body': 'Heroes in a half shell.'}
        build.complete_subjob(subjob.subjob_id(), payload=payload)

        self.mock_fs.write_file.assert_called_once_with('Heroes in a half shell.', '/tmp/results/1/turtles.txt')
        self.mock_fs.extract_tar.assert_called_once_with('/tmp/results/1/turtles.txt', delete=True)
开发者ID:OspreyX,项目名称:ClusterRunner,代码行数:14,代码来源:test_build.py

示例6: test_allocate_slave_calls_slave_setup

# 需要导入模块: from app.master.build import Build [as 别名]
# 或者: from app.master.build.Build import build_id [as 别名]
    def test_allocate_slave_calls_slave_setup(self):
        # arrange
        subjobs = self._create_subjobs()

        mock_project_type = self._create_mock_project_type()
        fake_setup_command = 'docker pull my:leg'
        mock_slave = self._create_mock_slave()

        # act
        build = Build(BuildRequest({'setup': fake_setup_command}))
        build.prepare(subjobs, mock_project_type, self._create_job_config(self._FAKE_MAX_EXECUTORS))
        build.allocate_slave(mock_slave)

        # assert
        mock_slave.setup.assert_called_once_with(build.build_id(), project_type_params={'setup': fake_setup_command})
开发者ID:mdengler,项目名称:ClusterRunner,代码行数:17,代码来源:test_build.py

示例7: add

# 需要导入模块: from app.master.build import Build [as 别名]
# 或者: from app.master.build.Build import build_id [as 别名]
 def add(cls, build: Build):
     """
     Add new build to collection
     :param build: The build to add to the store
     """
     cls._all_builds_by_id[build.build_id()] = build
开发者ID:box,项目名称:ClusterRunner,代码行数:8,代码来源:build_store.py


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