Best Python code snippet using autotest_python
job_aborter.py
Source:job_aborter.py
...55 lease.id: lease for lease in leasing.leases_iter(jobdir)56 if not lease.expired()57 }58 _mark_expired_jobs_failed(metrics, active_leases)59 _abort_timed_out_jobs(active_leases)60 _abort_jobs_marked_aborting(active_leases)61 _abort_special_tasks_marked_aborted()62 _clean_up_expired_leases(jobdir)63 # TODO(crbug.com/748234): abort_jobs_past_max_runtime goes into64 # lucifer_run_job65def _mark_expired_jobs_failed(metrics, active_leases):66 """Mark expired jobs failed.67 Expired jobs are jobs that have an incomplete JobHandoff and that do68 not have an active lease. These jobs have been handed off to a69 job_reporter, but that job_reporter has crashed. These jobs are70 marked failed in the database.71 @param metrics: _Metrics instance.72 @param active_leases: dict mapping job ids to Leases.73 """74 logger.debug('Looking for expired jobs')75 job_ids = []76 for handoff in handoffs.incomplete():77 logger.debug('Found handoff: %d', handoff.job_id)78 if handoff.job_id not in active_leases:79 logger.debug('Handoff %d is missing active lease', handoff.job_id)80 job_ids.append(handoff.job_id)81 handoffs.clean_up(job_ids)82 handoffs.mark_complete(job_ids)83 metrics.send_expired_jobs(len(job_ids))84def _abort_timed_out_jobs(active_leases):85 """Send abort to timed out jobs.86 @param active_leases: dict mapping job ids to Leases.87 """88 for job in _timed_out_jobs_queryset():89 if job.id in active_leases:90 active_leases[job.id].maybe_abort()91def _abort_jobs_marked_aborting(active_leases):92 """Send abort to jobs marked aborting in Autotest database.93 @param active_leases: dict mapping job ids to Leases.94 """95 for job in _aborting_jobs_queryset():96 if job.id in active_leases:97 active_leases[job.id].maybe_abort()98def _abort_special_tasks_marked_aborted():...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!