Best Python code snippet using autotest_python
prejob_task.py
Source:prejob_task.py
...53from autotest_lib.scheduler import agent_task, scheduler_config54from autotest_lib.server import autoserv_utils55from autotest_lib.server.cros import provision56class PreJobTask(agent_task.SpecialAgentTask):57 def _copy_to_results_repository(self):58 if not self.queue_entry or self.queue_entry.meta_host:59 return60 self.queue_entry.set_execution_subdir()61 log_name = os.path.basename(self.task.execution_path())62 source = os.path.join(self.task.execution_path(), 'debug',63 'autoserv.DEBUG')64 destination = os.path.join(65 self.queue_entry.execution_path(), log_name)66 self.monitor.try_copy_to_results_repository(67 source, destination_path=destination)68 def epilog(self):69 super(PreJobTask, self).epilog()70 if self.success:71 return72 if self.host.protection == host_protections.Protection.DO_NOT_VERIFY:73 # effectively ignore failure for these hosts74 self.success = True75 return76 if self.queue_entry:77 # If we requeue a HQE, we should cancel any remaining pre-job78 # tasks against this host, otherwise we'll be left in a state79 # where a queued HQE has special tasks to run against a host.80 models.SpecialTask.objects.filter(...
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!!