def __init__(self, server, DEBUG=False, address='127.0.0.1', port=3855, enabled=True, **kwargs): """ Handles implementing default configurations """ logger = server.register_logger('monitor') wsgi_logger = server.register_logger('monitor_wsgi') if not enabled: logger.info("HTTP monitor not enabled, not starting up...") return else: logger.info("HTTP monitor enabled, starting up...") app = Flask('monitor') app.config.update(kwargs) app.config['DEBUG'] = debug app.register_blueprint(main) # Monkey patch the wsgi logger Logger.logger = wsgi_logger app.real_logger = logger # setup localproxy refs app.server = server app.jobmanager = server.jobmanager app.reporter = server.reporter app.stratum_manager = server.stratum_manager WSGIServer.__init__(self, (address, port), app, log=Logger())
def start(self, *args, **kwargs): WSGIServer.__init__(self, self.settings['ui_address'], self.app, spawn=100, log=Logger()) self.logger.info("Monitoring port listening on {}" .format(self.settings['ui_address'])) # Monkey patch the wsgi logger Logger.logger = self.logger WSGIServer.start(self, *args, **kwargs)
def start(self, *args, **kwargs): listener = (self.config['address'], self.config['port'] + self.manager.config['server_number']) WSGIServer.__init__(self, listener, self.app, spawn=100, log=Logger()) self.logger.info("Monitoring port listening on {}".format(listener)) # Monkey patch the wsgi logger Logger.logger = self.logger WSGIServer.start(self, *args, **kwargs) Component.start(self)
def start(self, *args, **kwargs): WSGIServer.__init__(self, self.settings['ui_address'], self.app, spawn=100, log=Logger()) self.logger.info("Monitoring port listening on {}".format( self.settings['ui_address'])) # Monkey patch the wsgi logger Logger.logger = self.logger WSGIServer.start(self, *args, **kwargs)
def __init__(self, server, debug=False, address='127.0.0.1', port=3855, enabled=True, **kwargs): """ Handles implementing default configurations """ logger = server.register_logger('monitor') wsgi_logger = server.register_logger('monitor_wsgi') if not enabled: logger.info("HTTP monitor not enabled, not starting up...") return else: logger.info("HTTP monitor enabled, starting up...") app = Flask('monitor') app = Flask('monitor', static_folder='../static', static_url_path='/static') # set our template path and configs app.jinja_loader = FileSystemLoader(os.path.join(root, 'templates')) app.config.update(kwargs) app.config['DEBUG'] = debug app.register_blueprint(main) # Monkey patch the wsgi logger Logger.logger = wsgi_logger app.real_logger = logger @app.template_filter('duration') def time_format(seconds): # microseconds if seconds > 3600: return "{}".format(timedelta(seconds=seconds)) if seconds > 60: return "{:,.2f} mins".format(seconds / 60.0) if seconds <= 1.0e-3: return "{:,.4f} us".format(seconds * 1000000.0) if seconds <= 1.0: return "{:,.4f} ms".format(seconds * 1000.0) return "{:,.4f} sec".format(seconds) # setup localproxy refs app.server = server WSGIServer.__init__(self, (address, port), app, log=Logger()) @app.template_filter('datetime') def jinja_format_datetime(value, fmt='medium'): if fmt == 'full': fmt = "EEEE, MMMM d y 'at' HH:mm" elif fmt == 'medium': fmt = "EE MM/dd/y HH:mm" return value.strftime(fmt)
def __init__(self, config): self._configure(config) app = Flask(__name__) app.config.update(self.config) app.add_url_rule('/', 'general', self.general) app.add_url_rule('/debug/', 'debug', self.debug) app.add_url_rule('/counters/', 'counters', self.counters) app.add_url_rule('/client/<address>/', 'client', self.client) app.add_url_rule('/<comp_key>/clients/', 'serv_clients_comp', self.clients_comp) app.add_url_rule('/<comp_key>/', 'component', self.comp) app.add_url_rule('/viewer/', 'viewer', self.viewer) app.add_url_rule('/viewer/<path:filename>', 'viewer_sub', self.viewer) # Legacy app.add_url_rule('/05/clients/', 'clients', self.clients_0_5) app.add_url_rule('/05/', 'general_0_5', self.general_0_5) self.viewer_dir = os.path.join(os.path.abspath( os.path.dirname(__file__) + '/../'), 'viewer') self.app = app WSGIServer.__init__(self, (self.config['address'], self.config['port']), self.app, spawn=100, log=Logger())
def __init__(self, listener, application=None, security_by_host=False, allow_hosts=None, **kwargs): WSGIServer.__init__(self, listener, application=application, **kwargs) self._security_by_host = security_by_host self._allow_hosts = allow_hosts