Lines Matching full:job
60 parser.add_option("-r", help="Reparse the results of a job",
65 "in the job name"),
93 help=("Allows parsing job to attempt to create a suite "
94 "timeline report, if it detects that the job being "
95 "parsed is a suite job."),
150 @param jobname: String representing the job name.
162 def mailfailure(jobname, job, message): argument
165 @param jobname: String representing the job name.
166 @param job: A job object.
170 message_lines.append("The following tests FAILED for this job")
174 message_lines.append(format_failure_message("Job name", "Kernel",
181 subject = "AUTOTEST: FAILED tests from job %s" % jobname
182 mail.send("", job.user, "", subject, message_header + message)
188 Whenever a retry job is complete, we want to invalidate the original
189 job's test results, such that the consumers of the tko database
192 When a retry job is parsed, we retrieve the original job's afe_job_id
193 from the retry job's keyvals, which is then converted to tko job_idx and
197 associated with the original job by flipping their 'invalid' bit to True.
202 associated with the retry job.
204 For example, assume Job(job_idx=105) are retried by Job(job_idx=108), after
214 Note the invalid bits of the rows for Job(job_idx=105) are set to '1'.
215 And the 'invalidates_test_idx' fields of the rows for Job(job_idx=108)
216 are set to 10 and 11 (the test_idx of the rows for the original job).
218 @param orig_job_idx: An integer representing the original job's
219 tko job_idx. Tests associated with this job will
221 @param retry_job_idx: An integer representing the retry job's
223 of the tests associated with this job will be updated.
240 # Note that within the scope of a job, (test, subdir) uniquelly
244 # job.run_test('dummy_Fail', tag='Error', subdir_tag='subdir_1')
245 # job.run_test('dummy_Fail', tag='Error', subdir_tag='subdir_2')
253 # in invalidated_tests. This could happen when the original job
255 # since the beginning of the job, in which case invalidated_tests
261 tko_utils.dprint('DEBUG: Invalidated tests associated to job: ' + msg)
313 def export_tko_job_to_file(job, jobname, filename): argument
314 """Exports the tko job to disk file.
316 @param job: database object.
317 @param jobname: the job name as string.
323 serializer.serialize_to_binary(job, jobname, filename)
327 """Parse a single job. Optionally send email on failure.
331 @param jobname: the tag used to search for existing job in db,
346 tko_utils.dprint("! Job is already parsed, done")
350 job_keyval = models.job.read_keyval(path)
354 job = parser.make_job(path)
358 tko_utils.dprint("! Unable to parse job, no status file")
360 _parse_status_log(parser, job, status_log_path)
363 job.job_idx = old_job_idx
364 unmatched_tests = _match_existing_tests(db, job)
368 job.afe_job_id = tko_utils.get_afe_job_id(jobname)
369 job.skylab_task_id = tko_utils.get_skylab_task_id(jobname)
370 job.afe_parent_job_id = job_keyval.get(constants.PARENT_JOB_ID)
371 job.skylab_parent_task_id = job_keyval.get(constants.PARENT_JOB_ID)
372 job.build = None
373 job.board = None
374 job.build_version = None
375 job.suite = None
376 if job.label:
377 label_info = site_utils.parse_job_name(job.label)
379 job.build = label_info.get('build', None)
380 job.build_version = label_info.get('build_version', None)
381 job.board = label_info.get('board', None)
382 job.suite = label_info.get('suite', None)
384 if 'suite' in job.keyval_dict:
385 job.suite = job.keyval_dict['suite']
396 job.keyval_dict.update(result_size_info.__dict__)
403 for test in job.tests:
422 % (jobname, job.user))
423 mailfailure(jobname, job, message)
430 for test in job.tests:
431 perf_uploader.upload_test(job, test, jobname)
433 # Upload job details to Sponge.
434 sponge_url = sponge_utils.upload_results(job, log=tko_utils.dprint)
436 job.keyval_dict['sponge_url'] = sponge_url
438 _write_job_to_db(db, jobname, job)
440 # Verify the job data is written to the database.
441 if job.tests:
442 tests_in_db = db.find_tests(job.job_idx)
444 if tests_in_db_count != len(job.tests):
447 'job should have %d tests, only found %d tests.' %
448 (job.job_idx, len(job.tests), tests_in_db_count))
452 'save job to TKO database.').increment()
460 # Handle retry job.
464 orig_job_idx = tko_models.Job.objects.get(
466 _invalidate_original_tests(orig_job_idx, job.job_idx)
468 # Serializing job into a binary file
472 binary_file_name = os.path.join(path, "job.serialize")
474 export_tko_job_to_file(job, jobname, binary_file_name)
480 # Check whether this is a suite job, a suite job will be a hostless job, its
486 and job.suite and datastore_parent_key):
491 (common.autotest_dir, job.afe_job_id,
534 def _write_job_to_db(db, jobname, job): argument
535 """Write all TKO data associated with a job to DB.
537 This updates the job object as a side effect.
540 @param jobname: Name of the job to write.
541 @param job: tko.models.job object.
543 db.insert_or_update_machine(job)
544 db.insert_job(jobname, job)
546 job,
549 db.update_job_keyvals(job)
550 for test in job.tests:
551 db.insert_test(job, test)
562 def _parse_status_log(parser, job, status_log_path): argument
564 parser.start(job)
568 job.tests = []
573 job.tests.append(test)
576 def _match_existing_tests(db, job): argument
577 """Find entries in the DB corresponding to the job's tests, update job.
581 old_job_idx = job.job_idx
590 for test in job.tests:
614 Returns a list of job subdirectories at path. Returns None if the test
615 is itself a job directory. Does not recurse into the subdirs.
634 # this is a job directory, or something else we don't understand
644 @param level: Integer, level of subdirectories to include in the job name.
647 @returns: The job name of the parsed job, e.g. '123-chromeos-test/host1'
662 @param level: Integer, level of subdirectories to include in the job name.
665 @returns: A set of job names of the parsed jobs.
678 # multi-machine job
685 # single machine job
695 When monitor_db is run via upstart, restarting the job sends SIGTERM to
746 # build up the list of job dirs to parse