def _create_sub_task(self, index: Optional[int], est_timeout: TimeoutEstimate, suite: GeneratedSuite, params: ResmokeGenTaskParams) -> Task: """ Create the sub task for the given suite. :param index: index of sub_suite. :param est_timeout: timeout estimate. :param suite: Parent suite being created. :param params: Parameters describing how tasks should be generated. :return: Shrub configuration for the sub-suite. """ return self._generate_task(suite.sub_suite_config_file(index), suite.sub_suite_task_name(index), est_timeout, params, suite)
def _create_sub_task(self, index: Optional[int], est_timeout: TimeoutEstimate, suite: GeneratedSuite, params: ResmokeGenTaskParams) -> ResmokeTask: """ Create the sub task for the given suite. :param index: index of sub_suite. :param est_timeout: timeout estimate. :param suite: Parent suite being created. :param params: Parameters describing how tasks should be generated. :return: ResmokeTask object describing the task. """ return self._generate_task( suite.sub_suite_config_file(index), suite.sub_suite_task_name(index), [] if index is None else suite.sub_suite_test_list(index), est_timeout, params, suite, excludes=suite.get_test_list() if index is None else [])
def _tests_dict_to_generated_suites(task_info: TaskInfo, tests_runtimes: List[TestRuntime]): """Convert diction of tests to `GenerateSuite` objects to conform to the *GenTaskService interface.""" sub_suites = [] for _, test in enumerate(task_info.tests): sub_suites.append(SubSuite([test], 0, tests_runtimes)) return GeneratedSuite(sub_suites=sub_suites, build_variant=task_info.build_variant, task_name=task_info.display_task_name, suite_name=task_info.suite)
def _generate_suites_config(self, generated_suite: GeneratedSuite) -> List[GeneratedFile]: """ Generate the suites files and evergreen configuration for the generated task. :return: The suites files and evergreen configuration for the generated task. """ test_list = generated_suite.get_test_list() return self.resmoke_proxy.render_suite_files( generated_suite.sub_suites, generated_suite.suite_name, generated_suite.filename, test_list, self.gen_options.create_misc_suite, generated_suite.build_variant)
def build_mock_suite(n_sub_suites, include_runtimes=True): return GeneratedSuite( sub_suites=[ SubSuite(test_list=[f"test_{i*j}" for j in range(3)], runtime_list=[ TestRuntime(test_name=f"test_{i*j}", runtime=3.14) for j in range(3) ] if include_runtimes else None, task_overhead=0) for i in range(n_sub_suites) ], build_variant="build variant", task_name="task name", suite_name="suite name", )
def generate_task(self, generated_suite: GeneratedSuite, build_variant: BuildVariant, gen_params: ResmokeGenTaskParams) -> None: """ Generate evergreen configuration for the given suite and add it to the build_variant. :param generated_suite: Suite to add. :param build_variant: Build variant to add generated configuration to. :param gen_params: Parameters to configuration how tasks are generated. """ # self.build_tasks = self.evg_api.tasks_by_build(self.options.build_id) execution_tasks = self.resmoke_gen_task_service.generate_tasks(generated_suite, gen_params) distros = self._get_distro(build_variant.name, gen_params.use_large_distro, gen_params.large_distro_name) build_variant.display_task(generated_suite.display_task_name(), execution_tasks=execution_tasks, distros=distros)
def _generate_suites_config( self, generated_suite: GeneratedSuite, is_multiversion: bool = False) -> List[GeneratedFile]: """ Generate the suites files and evergreen configuration for the generated task. :param generated_suite: Generated suite to create config files for. :param is_multiversion: True if the generated suite is a multiversion suite. :return: The suites files and evergreen configuration for the generated task. """ test_list = generated_suite.get_test_list() return self.resmoke_proxy.render_suite_files( generated_suite.sub_suites, generated_suite.suite_name, generated_suite.filename, test_list, self.gen_options.create_misc_suite, generated_suite.build_variant, is_multiversion)
def generate_multiversion_task( self, generated_suite: GeneratedSuite, build_variant: BuildVariant, gen_params: MultiversionGenTaskParams) -> None: """ Generate evergreen configuration for the given suite and add it to the build_variant. :param generated_suite: Suite to add. :param build_variant: Build variant to add generated configuration to. :param gen_params: Parameters to configuration how tasks are generated. """ execution_tasks = self.multiversion_gen_task_service.generate_tasks( generated_suite, gen_params) distros = self._get_distro(build_variant.name, gen_params.use_large_distro, gen_params.large_distro_name) build_variant.display_task(generated_suite.display_task_name(), execution_tasks=execution_tasks, distros=distros, activate=False)