How to use _check_queue_entry_statuses method in autotest

Best Python code snippet using autotest_python

postjob_task.py

Source:postjob_task.py Github

copy

Full Screen

...178 return len(self.queue_entries)179 def _pidfile_name(self):180 return drone_manager.CRASHINFO_PID_FILE181 def prolog(self):182 self._check_queue_entry_statuses(183 self.queue_entries,184 allowed_hqe_statuses=(models.HostQueueEntry.Status.GATHERING,),185 allowed_host_statuses=(models.Host.Status.RUNNING,))186 super(GatherLogsTask, self).prolog()187 def epilog(self):188 super(GatherLogsTask, self).epilog()189 self._parse_results(self.queue_entries)190 self._reboot_hosts()191 def _reboot_hosts(self):192 if self._autoserv_monitor.has_process():193 final_success = (self._final_status() ==194 models.HostQueueEntry.Status.COMPLETED)195 num_tests_failed = self._autoserv_monitor.num_tests_failed()196 else:197 final_success = False198 num_tests_failed = 0199 reboot_after = self._job.reboot_after200 do_reboot = (201 # always reboot after aborted jobs202 self._final_status() == models.HostQueueEntry.Status.ABORTED203 or reboot_after == model_attributes.RebootAfter.ALWAYS204 or (reboot_after == model_attributes.RebootAfter.IF_ALL_TESTS_PASSED205 and final_success and num_tests_failed == 0)206 or num_tests_failed > 0)207 for queue_entry in self.queue_entries:208 if do_reboot:209 # don't pass the queue entry to the CleanupTask. if the cleanup210 # fails, the job doesn't care -- it's over.211 models.SpecialTask.objects.create(212 host=models.Host.objects.get(id=queue_entry.host.id),213 task=models.SpecialTask.Task.CLEANUP,214 requested_by=self._job.owner_model())215 else:216 queue_entry.host.set_status(models.Host.Status.READY)217 def run(self):218 autoserv_exit_code = self._autoserv_monitor.exit_code()219 # only run if Autoserv exited due to some signal. if we have no exit220 # code, assume something bad (and signal-like) happened.221 if autoserv_exit_code is None or os.WIFSIGNALED(autoserv_exit_code):222 super(GatherLogsTask, self).run()223 else:224 self.finished(True)225class FinalReparseTask(SelfThrottledPostJobTask):226 def __init__(self, queue_entries):227 super(FinalReparseTask, self).__init__(queue_entries,228 log_file_name='.parse.log')229 # don't use _set_ids, since we don't want to set the host_ids230 self.queue_entry_ids = [entry.id for entry in queue_entries]231 def _generate_command(self, results_dir):232 return [_parser_path, '--write-pidfile', '--record-duration',233 '-l', '2', '-r', '-o', results_dir]234 @property235 def num_processes(self):236 return 0 # don't include parser processes in accounting237 def _pidfile_name(self):238 return drone_manager.PARSER_PID_FILE239 @classmethod240 def _max_processes(cls):241 return scheduler_config.config.max_parse_processes242 def prolog(self):243 self._check_queue_entry_statuses(244 self.queue_entries,245 allowed_hqe_statuses=(models.HostQueueEntry.Status.PARSING,))246 super(FinalReparseTask, self).prolog()247 def epilog(self):248 super(FinalReparseTask, self).epilog()249 self._archive_results(self.queue_entries)250class ArchiveResultsTask(SelfThrottledPostJobTask):251 _ARCHIVING_FAILED_FILE = '.archiver_failed'252 def __init__(self, queue_entries):253 super(ArchiveResultsTask, self).__init__(queue_entries,254 log_file_name='.archiving.log')255 # don't use _set_ids, since we don't want to set the host_ids256 self.queue_entry_ids = [entry.id for entry in queue_entries]257 def _pidfile_name(self):258 return drone_manager.ARCHIVER_PID_FILE259 # TODO: Refactor into autoserv_utils. crbug.com/243090260 def _generate_command(self, results_dir):261 return [autoserv_utils.autoserv_path , '-p',262 '--pidfile-label=%s' % self._pidfile_label(), '-r', results_dir,263 '--use-existing-results', '--control-filename=control.archive',264 os.path.join(drones.AUTOTEST_INSTALL_DIR, 'scheduler',265 'archive_results.control.srv')]266 @classmethod267 def _max_processes(cls):268 return scheduler_config.config.max_transfer_processes269 def prolog(self):270 self._check_queue_entry_statuses(271 self.queue_entries,272 allowed_hqe_statuses=(models.HostQueueEntry.Status.ARCHIVING,))273 super(ArchiveResultsTask, self).prolog()274 def epilog(self):275 super(ArchiveResultsTask, self).epilog()276 if not self.success and self._paired_with_monitor().has_process():277 failed_file = os.path.join(self._working_directory(),278 self._ARCHIVING_FAILED_FILE)279 paired_process = self._paired_with_monitor().get_process()280 self._drone_manager.write_lines_to_file(281 failed_file, ['Archiving failed with exit code %s'282 % self.monitor.exit_code()],283 paired_with_process=paired_process)284 self._set_all_statuses(self._final_status())

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful