def _forkwait(self, pid, timeout=None): """Wait for the given pid to complete @param pid (int) process id to wait for @param timeout (int) seconds to wait before timing out the process""" if timeout: logging.debug('Waiting for pid %d for %d seconds', pid, timeout) parallel.fork_waitfor_timed(self.resultdir, pid, timeout) else: logging.debug('Waiting for pid %d', pid) parallel.fork_waitfor(self.resultdir, pid) logging.info('pid %d completed', pid)
def close(self): """ Close SyncListenServer thread. Close all open connection with clients and listen server. """ utils.signal_pid(self.server_pid, signal.SIGTERM) if utils.pid_is_alive(self.server_pid): parallel.fork_waitfor_timed(self.tmpdir.name, self.server_pid, 2 * _DEFAULT_TIMEOUT) self.tmpdir.clean() logging.debug("SyncListenServer was killed.")
def close(self): """ Close SyncListenServer thread. Close all open connection with clients and listen server. """ utils.signal_pid(self.server_pid, signal.SIGTERM) if utils.pid_is_alive(self.server_pid): parallel.fork_waitfor_timed(self.tmpdir.name, self.server_pid, 2 * _DEFAULT_TIMEOUT) self.tmpdir.clean() logging.debug("SyncListenServer was killed.")
def _runtest(self, url, tag, timeout, args, dargs): try: l = lambda : test.runtest(self, url, tag, args, dargs) pid = parallel.fork_start(self.resultdir, l) if timeout: logging.debug('Waiting for pid %d for %d seconds', pid, timeout) parallel.fork_waitfor_timed(self.resultdir, pid, timeout) else: parallel.fork_waitfor(self.resultdir, pid) except error.TestBaseException: # These are already classified with an error type (exit_status) raise except error.JobError: raise # Caught further up and turned into an ABORT. except Exception, e: # Converts all other exceptions thrown by the test regardless # of phase into a TestError(TestBaseException) subclass that # reports them with their full stack trace. raise error.UnhandledTestError(e)
def _runtest(self, url, tag, timeout, args, dargs): try: l = lambda : test.runtest(self, url, tag, args, dargs) pid = parallel.fork_start(self.resultdir, l) if timeout: logging.debug('Waiting for pid %d for %d seconds', pid, timeout) parallel.fork_waitfor_timed(self.resultdir, pid, timeout) else: parallel.fork_waitfor(self.resultdir, pid) except error.TestBaseException: # These are already classified with an error type (exit_status) raise except error.JobError: raise # Caught further up and turned into an ABORT. except Exception, e: # Converts all other exceptions thrown by the test regardless # of phase into a TestError(TestBaseException) subclass that # reports them with their full stack trace. raise error.UnhandledTestError(e)