How to use report_worker_error_logs method in Slash

Best Python code snippet using slash

parallel_manager.py

Source:parallel_manager.py Github

copy

Full Screen

...50 self.keepalive_server_thread.start()51 def kill_workers(self):52 for worker in list(self.workers.values()):53 worker.kill()54 def report_worker_error_logs(self):55 found_worker_errors_file = False56 for file_name in os.listdir(self.workers_error_dircetory):57 if file_name.startswith(config.root.parallel.worker_error_file):58 found_worker_errors_file = True59 with open(os.path.join(self.workers_error_dircetory, file_name)) as worker_file:60 content = worker_file.readlines()61 for line in content:62 _logger.error("{}: {}", file_name, line, extra={'capture': False})63 if not found_worker_errors_file:64 _logger.error("No worker error files were found", extra={'capture': False})65 def handle_error(self, failure_message):66 _logger.error(failure_message, extra={'capture': False})67 self.kill_workers()68 self.report_worker_error_logs()69 get_xmlrpc_proxy(config.root.parallel.server_addr, self.server.port).report_session_error(failure_message)70 raise ParallelTimeout(failure_message)71 def wait_all_workers_to_connect(self):72 while self.server.state == ServerStates.WAIT_FOR_CLIENTS:73 if time.time() - self.server.start_time > config.root.parallel.worker_connect_timeout * self.workers_num: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():93 _logger.error("Clients that are still connected to server: {}",94 self.server.connected_clients, extra={'capture': False})95 if self.server.has_more_tests():96 _logger.error("Number of unstarted tests: {}", len(self.server.get_unstarted_tests()),97 extra={'capture': False})98 if self.server.executing_tests:99 _logger.error("Currently executed tests indexes: {}", self.server.executing_tests.values(),...

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 Slash 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