Best Python code snippet using ATX
service.py
Source:service.py
...32 self.running = False33 self.httpServer = None34 with open(CONFIG_PATH) as config_fp:35 self.config = json.load(config_fp)36 def _sig_handler(self):37 self.logger.writeInfo("Stopping...")38 self._stop()39 def _start(self):40 gevent.signal(signal.SIGINT, self._sig_handler)41 gevent.signal(signal.SIGTERM, self._sig_handler)42 self.httpServer = HttpServer(GroupingAPI, PORT, '0.0.0.0', ssl=self.config.get("ssl"))43 self.httpServer.start()44 while not self.httpServer.started.is_set():45 self.logger.writeInfo('Waiting for httpserver to start...')46 self.httpServer.started.wait()47 if self.httpServer.failed is not None:48 raise self.httpServer.failed49 self.httpServer.api.app.config.update(self.config)50 db_mongo.init_app(self.httpServer.api.app, logger=self.logger)...
main_app.py
Source:main_app.py
...32 self._curr_mgr = None33 self._devices_db = DbMgr()34 self._devices_db.load()35 self._job_mgr = JobMgr()36 def _sig_handler(self, signum, _):37 logger.info("Got signal %s, terminating...", signum)38 if self._curr_mgr:39 self._curr_mgr.terminate()40 sys.exit(0)41 def run(self):42 signal.signal(signal.SIGINT, self._sig_handler)43 signal.signal(signal.SIGTERM, self._sig_handler)44 logger.info("Starting new session")45 report_logger.info("*****Start*****")46 for mgr_cls in self.MANAGER_CLASSES:47 logger.info("Starting Manager: %s", mgr_cls.__name__)48 self._curr_mgr = mgr_cls(self._devices_db, self._job_mgr)49 self._curr_mgr.run()50 report_logger.info("******End******")...
statsd.py
Source:statsd.py
...16 def post(self):17 """Example of increasing a counter."""18 self.increase_counter('request', 'path')19 self.set_status(204)20def _sig_handler(*args_):21 iol = ioloop.IOLoop.instance()22 iol.add_callback_from_signal(iol.stop)23def make_application():24 """25 Create a application configured to send metrics.26 Metrics will be sent to localhost:8125 namespaced with27 ``webapps``. Run netcat or a similar listener then run this28 example. HTTP GETs will result in a metric like::29 webapps.SimpleHandler.GET.204:255.24497032165527|ms30 """31 settings = {}32 application = web.Application([web.url('/', SimpleHandler)], **settings)33 statsd.install(application, **{'namespace': 'testing'})34 return application...
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!!