How to use _handle_pidfile_error method in autotest

Best Python code snippet using autotest_python

pidfile_monitor.py

Source:pidfile_monitor.py Github

copy

Full Screen

...81 if contents.is_invalid():82 self._state = drone_manager.PidfileContents()83 raise self._PidfileException(contents)84 self._state = contents85 def _handle_pidfile_error(self, error, message=''):86 self.on_lost_process(self._state.process)87 def _get_pidfile_info_helper(self):88 if self.lost_process:89 return90 self._read_pidfile()91 if self._state.process is None:92 self._handle_no_process()93 return94 if self._state.exit_status is None:95 # double check whether or not autoserv is running96 if self._drone_manager.is_process_running(self._state.process):97 return98 # pid but no running process - maybe process *just* exited99 self._read_pidfile(use_second_read=True)100 if self._state.exit_status is None:101 # autoserv exited without writing an exit code102 # to the pidfile103 self._handle_pidfile_error(104 'autoserv died without writing exit code')105 def _get_pidfile_info(self):106 """\107 After completion, self._state will contain:108 pid=None, exit_status=None if autoserv has not yet run109 pid!=None, exit_status=None if autoserv is running110 pid!=None, exit_status!=None if autoserv has completed111 """112 try:113 self._get_pidfile_info_helper()114 except self._PidfileException, exc:115 self._handle_pidfile_error('Pidfile error', traceback.format_exc())116 def _handle_no_process(self):117 """\118 Called when no pidfile is found or no pid is in the pidfile.119 """120 if time.time() - self._start_time > _get_pidfile_timeout_secs():121 # If we aborted the process, and we find that it has exited without122 # writing a pidfile, then it's because we killed it, and thus this123 # isn't a surprising situation.124 if not self._killed:125 metrics.Counter('chromeos/autotest/errors/scheduler/no_pidfile'126 ).increment()127 else:128 logging.warning("%s didn't exit after SIGTERM", self.pidfile_id)129 self.on_lost_process()...

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