Lines Matching full:job
66 parser.add_option("-r", help="Reparse the results of a job",
71 "in the job name"),
99 help=("Allows parsing job to attempt to create a suite "
100 "timeline report, if it detects that the job being "
101 "parsed is a suite job."),
141 @param jobname: String representing the job name.
153 def mailfailure(jobname, job, message): argument
156 @param jobname: String representing the job name.
157 @param job: A job object.
161 message_lines.append("The following tests FAILED for this job")
165 message_lines.append(format_failure_message("Job name", "Kernel",
172 subject = "AUTOTEST: FAILED tests from job %s" % jobname
173 mail.send("", job.user, "", subject, message_header + message)
179 Whenever a retry job is complete, we want to invalidate the original
180 job's test results, such that the consumers of the tko database
183 When a retry job is parsed, we retrieve the original job's afe_job_id
184 from the retry job's keyvals, which is then converted to tko job_idx and
188 associated with the original job by flipping their 'invalid' bit to True.
193 associated with the retry job.
195 For example, assume Job(job_idx=105) are retried by Job(job_idx=108), after
205 Note the invalid bits of the rows for Job(job_idx=105) are set to '1'.
206 And the 'invalidates_test_idx' fields of the rows for Job(job_idx=108)
207 are set to 10 and 11 (the test_idx of the rows for the original job).
209 @param orig_job_idx: An integer representing the original job's
210 tko job_idx. Tests associated with this job will
212 @param retry_job_idx: An integer representing the retry job's
214 of the tests associated with this job will be updated.
231 # Note that within the scope of a job, (test, subdir) uniquelly
235 # job.run_test('example_Fail', tag='Error', subdir_tag='subdir_1')
236 # job.run_test('example_Fail', tag='Error', subdir_tag='subdir_2')
244 # in invalidated_tests. This could happen when the original job
246 # since the beginning of the job, in which case invalidated_tests
252 tko_utils.dprint('DEBUG: Invalidated tests associated to job: ' + msg)
304 def export_tko_job_to_file(job, jobname, filename): argument
305 """Exports the tko job to disk file.
307 @param job: database object.
308 @param jobname: the job name as string.
314 serializer.serialize_to_binary(job, jobname, filename)
318 """Parse a single job. Optionally send email on failure.
322 @param jobname: the tag used to search for existing job in db,
327 @return job: the parsed job object
337 tko_utils.dprint("! Job is already parsed, done")
341 job_keyval = models.job.read_keyval(path)
345 job = parser.make_job(path)
349 tko_utils.dprint("! Unable to parse job, no status file")
351 _parse_status_log(parser, job, status_log_path)
354 job.job_idx = old_job_idx
355 unmatched_tests = _match_existing_tests(db, job)
359 job.afe_job_id = tko_utils.get_afe_job_id(jobname)
360 job.skylab_task_id = tko_utils.get_skylab_task_id(jobname)
361 job.afe_parent_job_id = job_keyval.get(constants.PARENT_JOB_ID)
362 job.skylab_parent_task_id = job_keyval.get(constants.PARENT_JOB_ID)
363 job.build = None
364 job.board = None
365 job.build_version = None
366 job.suite = None
367 if job.label:
368 label_info = site_utils.parse_job_name(job.label)
370 job.build = label_info.get('build', None)
371 job.build_version = label_info.get('build_version', None)
372 job.board = label_info.get('board', None)
373 job.suite = label_info.get('suite', None)
375 if 'suite' in job.keyval_dict:
376 job.suite = job.keyval_dict['suite']
389 job.keyval_dict.update(result_size_info._asdict())
396 for test in job.tests:
415 % (jobname, job.user))
416 mailfailure(jobname, job, message)
423 for test in job.tests:
424 perf_uploader.upload_test(job, test, jobname)
426 _write_job_to_db(db, jobname, job)
428 # Verify the job data is written to the database.
429 if job.tests:
430 tests_in_db = db.find_tests(job.job_idx)
432 if tests_in_db_count != len(job.tests):
435 'job should have %d tests, only found %d tests.' %
436 (job.job_idx, len(job.tests), tests_in_db_count))
440 'save job to TKO database.').increment()
448 # Handle retry job.
452 orig_job_idx = tko_models.Job.objects.get(
454 _invalidate_original_tests(orig_job_idx, job.job_idx)
456 # Serializing job into a binary file
460 binary_file_name = os.path.join(path, "job.serialize")
462 export_tko_job_to_file(job, jobname, binary_file_name)
485 return job
488 def _write_job_to_db(db, jobname, job): argument
489 """Write all TKO data associated with a job to DB.
491 This updates the job object as a side effect.
494 @param jobname: Name of the job to write.
495 @param job: tko.models.job object.
497 db.insert_or_update_machine(job)
498 db.insert_job(jobname, job)
500 job,
503 db.update_job_keyvals(job)
504 for test in job.tests:
505 db.insert_test(job, test)
516 def _parse_status_log(parser, job, status_log_path): argument
518 parser.start(job)
522 job.tests = []
527 job.tests.append(test)
530 def _match_existing_tests(db, job): argument
531 """Find entries in the DB corresponding to the job's tests, update job.
535 old_job_idx = job.job_idx
544 for test in job.tests:
568 Returns a list of job subdirectories at path. Returns None if the test
569 is itself a job directory. Does not recurse into the subdirs.
589 # this is a job directory, or something else we don't understand
599 @param level: Integer, level of subdirectories to include in the job name.
602 @returns: The job name of the parsed job, e.g. '123-chromeos-test/host1'
617 @param level: Integer, level of subdirectories to include in the job name.
620 @returns: A set of job names of the parsed jobs.
633 # multi-machine job
640 # single machine job
650 When monitor_db is run via upstart, restarting the job sends SIGTERM to
701 # build up the list of job dirs to parse