Lines Matching refs:job
10 """Send a job to LAVA, track it and collect log back"""
46 # Timeout in seconds to decide if the device from the dispatched LAVA job has
51 # check if the dispatched LAVA job is running or waiting in the job queue.
75 "job": {"minutes": args.job_timeout},
117 # skeleton test definition: only declaring each job as a single 'test'
143 # job execution script:
145 # - fetch and unpack per-pipeline build artifacts from build job
146 # - fetch and unpack per-job environment from lava-submit.sh
158 f'echo "export CI_JOB_JWT_FILE={args.jwt_file}" >> /set-job-env-vars.sh',
163 "sed -i '/MINIO_RESULTS_UPLOAD/d' /set-job-env-vars.sh",
290 f"Could not get LAVA job logs. Reason: {mesa_ci_err}"
296 """Use the console log to catch if the job has completed successfully or
319 f"LAVA job {job_id} failed with Infrastructure Error. Retry."
322 # This happens when LAVA assumes that the job cannot terminate or
323 # with mal-formed job definitions. As we are always validating the
325 # action timed out more times than expected in job definition.
327 f"LAVA job {job_id} failed with JobError "
332 f"LAVA job {job_id} failed validation (possible download error). Retry."
337 def find_lava_error(job) -> None:
339 results_yaml = _call_proxy(job.proxy.results.get_testjob_results_yaml, job.job_id)
343 find_exception_from_metadata(metadata, job.job_id)
345 # If we reach this far, it means that the job ended without hwci script
347 job.status = "fail"
350 def show_job_data(job):
353 "LAVA job info",
357 show = _call_proxy(job.proxy.scheduler.jobs.show, job.job_id)
362 def fetch_logs(job, max_idle_time, log_follower) -> None:
365 if datetime.now() - job.last_log_time > max_idle_time:
371 f"LAVA job {job.job_id} does not respond for {max_idle_time_min} "
383 new_log_lines = job.get_logs()
390 job.heartbeat()
393 # Only parse job results when the script reaches the end of the logs.
400 parsed_lines = job.parse_job_result_from_log(parsed_lines)
406 def follow_job_execution(job):
408 job.submit()
411 f"Could not submit LAVA job. Reason: {mesa_ci_err}"
414 print_log(f"Waiting for job {job.job_id} to start.")
415 while not job.is_started():
417 print_log(f"Job {job.job_id} started.")
430 # Start to check job's health
431 job.heartbeat()
432 while not job.is_finished:
433 fetch_logs(job, max_idle_time, lf)
435 show_job_data(job)
437 # Mesa Developers expect to have a simple pass/fail job result.
440 if job.status not in ["pass", "fail"]:
441 find_lava_error(job)
444 def print_job_final_status(job):
445 if job.status == "running":
446 job.status = "hung"
448 color = LAVAJob.COLOR_STATUS_MAP.get(job.status, CONSOLE_LOG["FG_RED"])
451 f"LAVA Job finished with status: {job.status}"
460 job = LAVAJob(proxy, job_definition)
462 follow_job_execution(job)
463 return job
466 job.status = "canceled"
469 job.cancel()
471 print_log("LAVA job submitter was interrupted. Cancelling the job.")
472 job.cancel()
477 f"Finished executing LAVA job in the attempt #{attempt_no}"
480 print_job_final_status(job)
493 # Remove mesa job names with spaces, which breaks the lava-test-case command
505 "LAVA job definition (YAML)",
510 job = LAVAJob(proxy, job_definition)
512 if errors := job.validate():
513 fatal_err(f"Error in LAVA job definition: {errors}")
514 print_log("LAVA job definition validated successfully")
525 parser = argparse.ArgumentParser("LAVA job submitter")
531 parser.add_argument("--job-rootfs-overlay-url")
532 parser.add_argument("--job-timeout", type=int)
545 parser.add_argument("--mesa-job-name")