def create_variant_tasks_if_needed(testcase): """Creates a variant task if needed.""" testcase_id = testcase.key.id() jobs = ndb_utils.get_all_from_model(data_types.Job) for job in jobs: # The variant needs to be tested in a different job type than us. job_type = job.name if testcase.job_type == job_type: continue # Don't try to reproduce engine fuzzer testcase with blackbox fuzzer # testcases and vice versa. if (environment.is_engine_fuzzer_job(testcase.job_type) != environment.is_engine_fuzzer_job(job_type)): continue # Skip experimental jobs. job_environment = job.get_environment() if utils.string_is_true(job_environment.get('EXPERIMENTAL')): continue # Don't look for variants in other projects. project_name = data_handler.get_project_name(job_type) if testcase.project_name != project_name: continue queue = tasks.queue_for_platform(job.platform) tasks.add_task('variant', testcase_id, job_type, queue) variant = data_handler.get_testcase_variant(testcase_id, job_type) variant.status = data_types.TestcaseVariantStatus.PENDING variant.put()
def create_variant_tasks_if_needed(testcase): """Creates a variant task if needed.""" if testcase.duplicate_of: # If another testcase exists with same params, no need to spend cycles on # calculating variants again. return testcase_id = testcase.key.id() project = data_handler.get_project_name(testcase.job_type) jobs = data_types.Job.query(data_types.Job.project == project) for job in jobs: # The variant needs to be tested in a different job type than us. job_type = job.name if testcase.job_type == job_type: continue # Don't try to reproduce engine fuzzer testcase with blackbox fuzzer # testcases and vice versa. if (environment.is_engine_fuzzer_job(testcase.job_type) != environment.is_engine_fuzzer_job(job_type)): continue # Skip experimental jobs. job_environment = job.get_environment() if utils.string_is_true(job_environment.get('EXPERIMENTAL')): continue queue = tasks.queue_for_platform(job.platform) tasks.add_task('variant', testcase_id, job_type, queue) variant = data_handler.get_testcase_variant(testcase_id, job_type) variant.status = data_types.TestcaseVariantStatus.PENDING variant.put()
def queue_name(project, platform): """Get the untrusted queue name for the project and platform.""" return tasks.queue_for_platform(platform_name(project, platform))