Best Python code snippet using autotest_python
status_server.py
Source:status_server.py
...44 allowed_users))45 if not drone.enabled:46 line += ' (disabled)'47 self._write_line(line)48 def _write_drone_list(self):49 self._write_line('Drones:')50 for drone in self.server._drone_manager.get_drones():51 self._write_drone(drone)52 self._write_line()53 def _execute_actions(self, arguments):54 if 'reparse_config' in arguments:55 scheduler_config.config.read_config()56 self.server._drone_manager.refresh_drone_configs()57 self._write_line('Reparsed config!')58 elif 'restart_scheduler' in arguments:59 self.server._shutdown_scheduler = True60 self._write_line('Posted the shutdown request')61 self._write_line()62 def do_GET(self):63 self._send_headers()64 self.wfile.write(_HEADER)65 arguments = self._parse_arguments()66 self._execute_actions(arguments)67 self._write_all_fields()68 self._write_drone_list()69 self.wfile.write(_FOOTER)70class StatusServer(BaseHTTPServer.HTTPServer):71 def __init__(self):72 address = ('', _PORT)73 # HTTPServer is an old-style class :(74 BaseHTTPServer.HTTPServer.__init__(self, address,75 StatusServerRequestHandler)76 self._shutting_down = False77 self._drone_manager = drone_manager.instance()78 self._shutdown_scheduler = False79 # ensure the listening socket is not inherited by child processes80 old_flags = fcntl.fcntl(self.fileno(), fcntl.F_GETFD)81 fcntl.fcntl(self.fileno(), fcntl.F_SETFD, old_flags | fcntl.FD_CLOEXEC)82 def shutdown(self):...
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!!