Best Python code snippet using autotest_python
scripts.py
Source:scripts.py
...22 parser.print_help()23 parser.error("Argument must be a comma seperated list of queues")24 log_level = getattr(logging, options.log_level.upper(), 'INFO')25 #logging.basicConfig(level=log_level, format="%(asctime)s: %(levelname)s: %(message)s")26 setup_pidfile(options.pidfile)27 interval = options.interval28 if interval is not None:29 interval = float(interval)30 queues = args[0].split(',')31 server = '%s:%s' % (options.host,options.port)32 Khan.run(pool_size=options.pool_size, queues=queues, server=server, logging_level=log_level, log_file=options.logfile)33def pyres_scheduler():34 usage = "usage: %prog [options] arg1"35 parser = OptionParser(usage=usage)36 #parser.add_option("-q", dest="queue_list")37 parser.add_option("--host", dest="host", default="localhost")38 parser.add_option("--port",dest="port",type="int", default=6379)39 parser.add_option('-l', '--log-level', dest='log_level', default='info', help='log level. Valid values are "debug", "info", "warning", "error", "critical", in decreasing order of verbosity. Defaults to "info" if parameter not specified.')40 parser.add_option('-f', dest='logfile', help='If present, a logfile will be used. "stderr", "stdout", and "syslog" are all special values.')41 parser.add_option('-p', dest='pidfile', help='If present, a pidfile will be used.')42 (options,args) = parser.parse_args()43 log_level = getattr(logging, options.log_level.upper(),'INFO')44 #logging.basicConfig(level=log_level, format="%(module)s: %(asctime)s: %(levelname)s: %(message)s")45 setup_logging(procname="pyres_scheduler", log_level=log_level, filename=options.logfile)46 setup_pidfile(options.pidfile)47 server = '%s:%s' % (options.host, options.port)48 Scheduler.run(server)49def pyres_web():50 usage = "usage: %prog [options]"51 parser = OptionParser(usage)52 parser.add_option("--host",53 dest="host",54 default="localhost",55 metavar="HOST")56 parser.add_option("--port",57 dest="port",58 type="int",59 default=8080)60 parser.add_option("--dsn",61 dest="dsn",62 help="Redis server to display")63 parser.add_option("--server",64 dest="server",65 help="Server for itty to run under.",66 default='wsgiref')67 (options,args) = parser.parse_args()68 if options.dsn:69 from pyres import ResQ70 resweb_server.HOST = ResQ(options.dsn)71 run_itty(host=options.host, port=options.port, server=options.server)72def pyres_worker():73 usage = "usage: %prog [options] arg1"74 parser = OptionParser(usage=usage)75 parser.add_option("--host", dest="host", default="localhost")76 parser.add_option("--port",dest="port",type="int", default=6379)77 parser.add_option("-i", '--interval', dest='interval', default=None, help='the default time interval to sleep between runs')78 parser.add_option('-l', '--log-level', dest='log_level', default='info', help='log level. Valid values are "debug", "info", "warning", "error", "critical", in decreasing order of verbosity. Defaults to "info" if parameter not specified.')79 parser.add_option('-f', dest='logfile', help='If present, a logfile will be used. "stderr", "stdout", and "syslog" are all special values.')80 parser.add_option('-p', dest='pidfile', help='If present, a pidfile will be used.')81 (options,args) = parser.parse_args()82 if len(args) != 1:83 parser.print_help()84 parser.error("Argument must be a comma seperated list of queues")85 log_level = getattr(logging, options.log_level.upper(), 'INFO')86 setup_logging(procname="pyres_worker", log_level=log_level, filename=options.logfile)87 setup_pidfile(options.pidfile)88 interval = options.interval89 if interval is not None:90 interval = int(interval)91 queues = args[0].split(',')92 server = '%s:%s' % (options.host,options.port)...
worker.py
Source:worker.py
...24 parser.print_help()25 parser.error("Argument must be a comma seperated list of queues")26 log_level = getattr(logging, options.log_level.upper(), 'INFO')27 setup_logging(procname="pyres_worker", log_level=log_level, filename=options.logfile)28 setup_pidfile(options.pidfile)29 interval = options.interval30 if interval is not None:31 interval = int(interval)32 timeout = options.timeout and int(options.timeout)33 queues = args[0].split(',')34 server = '{0}:{1}'.format(options.host, options.port)35 Worker.run(queues, server, options.password, interval, timeout=timeout)36if __name__ == '__main__':...
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!!