Best Python code snippet using slash
server.py
Source:server.py
...48 server.handle_request()49 _logger.debug("Exiting KeepAlive server loop")50 finally:51 server.server_close()52 def get_workers_last_connection_time(self):53 with self._lock:54 return copy.deepcopy(self.clients_last_communication_time)55class Server(object):56 def __init__(self, tests):57 super(Server, self).__init__()58 self.worker_error_reported = False59 self.interrupted = False60 self.state = ServerStates.NOT_INITIALIZED61 self.port = None62 self.tests = tests63 self.worker_session_ids = []64 self.executing_tests = {}65 self.finished_tests = []66 self.num_collections_validated = 0...
parallel_manager.py
Source:parallel_manager.py
...74 self.handle_error("Timeout: Not all clients connected to server, terminating.\n\75 Clients connected: {}".format(self.server.connected_clients))76 time.sleep(TIME_BETWEEN_CHECKS)77 def check_worker_timed_out(self):78 workers_last_connection_time = self.keepalive_server.get_workers_last_connection_time()79 for worker_id in self.server.get_connected_clients():80 worker_last_connection_time = workers_last_connection_time.get(worker_id, None)81 if worker_last_connection_time is None: #worker keepalive thread didn't started yet82 continue83 if time.time() - worker_last_connection_time > config.root.parallel.communication_timeout_secs:84 _logger.error("Worker {} is down, terminating session", worker_id, extra={'capture': False})85 self.report_worker_error_logs()86 self.workers[worker_id].handle_timeout()87 get_xmlrpc_proxy(config.root.parallel.server_addr, self.server.port).report_client_failure(worker_id)88 def check_no_requests_timeout(self):89 if time.time() - self.keepalive_server.last_request_time > config.root.parallel.no_request_timeout:90 _logger.error("No request sent to server for {} seconds, terminating",91 config.root.parallel.no_request_timeout, extra={'capture': False})92 if self.server.has_connected_clients():...
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!!