Beispiel #1
0
 def load_config(self):
     from gunicorn.six import iteritems
     config = dict([(key, value)
                    for key, value in iteritems(self.options)
                    if key in self.cfg.settings and value is not None])
     for key, value in iteritems(config):
         self.cfg.set(key.lower(), value)
Beispiel #2
0
    def load_config(self):
        config = dict([(key, value) for key, value in iteritems(self.options)
                       if key in self.cfg.settings and value is not None])

        for key, value in iteritems(config):
            print('conf', key.lower(), value)
            self.cfg.set(key.lower(), value)
    def load_config(self):
        config = dict([(key, value) for key, value in iteritems(self.options)
                       if key in self.cfg.settings and value is not None])

        cfg.logger.debug('self.cfg.settings: %s config: %s', self.cfg.settings, config)
        for key, value in iteritems(config):
            self.cfg.set(key.lower(), value)
Beispiel #4
0
    def load_config(self):
        config = dict([(key, value) for key, value in iteritems(self.options)
                       if key in self.cfg.settings and value is not None])
        for key, value in iteritems(config):
            self.cfg.set(key.lower(), value)

        self.cfg.set('worker_class', 'agora_gw.server.worker.Worker')
 def load_config(self):
     config = dict([
         (key, value)
         for key, value in iteritems(self.options)
         if key in self.cfg.settings and value is not None])
     for key, value in iteritems(config):
         self.cfg.set(key.lower(), value)
Beispiel #6
0
 def load_config(self):
     config = dict(
             [(key, value) for key, value in iteritems(self.options)
                 if key in self.cfg.settings and value is not None])
     for key, value in iteritems(config):
         self.cfg.set(key.lower(), value)
     self.cfg.set("logger_class", BypassGunicornLogging)
     self.cfg.set("accesslog", "dummy-value")
Beispiel #7
0
    def load_config(self):
        """

        """
        for key, value in iteritems(
                dict([(k, v) for k, v in iteritems(self.options)
                      if k in self.cfg.settings and v is not None])):
            self.cfg.set(key.lower(), value)
Beispiel #8
0
 def load_config(self):
     """
     Sets the values for configurations
     """
     config = dict([(key, value) for key, value in iteritems(self.options)
                    if key in self.cfg.settings and value is not None])
     for key, value in iteritems(config):
         self.cfg.set(key.lower(), value)
Beispiel #9
0
 def load_config(self):
     config = {
         key: value
         for key, value in iteritems(self.options)
         if key in self.cfg.settings and value is not None
     }
     for key, value in iteritems(config):
         self.cfg.set(key.lower(), value)
Beispiel #10
0
 def load_config(self):
     config = dict([(key, value)
                    for key, value in iteritems(vars(self.args_options))
                    if key in self.cfg.settings and value is not None])
     for key, value in iteritems(self.defaults):
         config[key] = value
     for key, value in iteritems(config):
         self.cfg.set(key.lower(), value)
Beispiel #11
0
    def load_config(self):
        """Load the configuration."""
        # Initialize key variables
        config = dict([(key, value) for key, value in iteritems(self.options)
                       if key in self.cfg.settings and value is not None])

        # Assign configuration parameters
        for key, value in iteritems(config):
            self.cfg.set(key.lower(), value)
Beispiel #12
0
    def load_config(self):
        config = dict([(key, value) for key, value in iteritems(self.options)
                       if key in self.cfg.settings and value is not None])
        for key, value in iteritems(config):
            self.cfg.set(key.lower(), value)

        if self.options['worker_class'] and \
                self.options['worker_class'] not in AVAILABLE_WORKERS:
            raise ValueError
Beispiel #13
0
 def load_config(self):
     """
     Load application configuration
     TODO: Move to voiceplay.utils.models.BaseCfgModel or similar
     """
     config = dict([(key, value) for key, value in iteritems(self.options)
                    if key in self.cfg.settings and value is not None])
     for key, value in iteritems(config):
         self.cfg.set(key.lower(), value)
Beispiel #14
0
def list2dict(conf):
    l = [(key, value) for key, value in iteritems(conf)
         if key in ('key3', 'key2') and value is not None]
    print l
    d = dict(l)
    print isinstance(d, dict)
    print d
Beispiel #15
0
    def prometheus_iter(self):
        for item in self:
            tags_str = ','.join('{}="{}"'.format(*kv)
                                for kv in six.iteritems(item.tags))
            if tags_str:
                tags_str = '{%s}' % tags_str

            yield '# TYPE {} {}'.format(item.metric_name, item.metric_type)
            yield '{}{} {}'.format(item.metric_name, tags_str, item.value)
Beispiel #16
0
def deploy():
    """
    Deploy app
    """
    app.config.update(DEBUG=False, TESTING=False)

    try:
        os.mkdir("log")
    except BaseException:
        pass

    for file_name in ["log/error.log", "log/access.log"]:
        if not os.path.exists(file_name):
            os.system("touch " + file_name)

    from gunicorn.app.wsgiapp import WSGIApplication
    guni_app = WSGIApplication()
    guni_app.app_uri = 'dueros:app'

    options = {
        'workers': 4,
        'accesslog': 'log/access.log',
        'errorlog': 'log/error.log',
        'loglevel': 'info',
        'bind': '127.0.0.1:8000',
    }

    config = dict([(key, value) for key, value in iteritems(options)])

    for key, value in iteritems(config):
        guni_app.cfg.set(key, value)

    print(
        "=======================================================================\n"
        "============================ start gunicorn ===========================\n"
        "======================================================================="
    )
    return guni_app.run()
    def load_config(self):
        """Load configuration.

        Configuration is loaded from the options passed in the constructor,
        and then load arguments from the CLI and the environment variable GUNICORN_CMD_ARGS.
        Arguments in the environment variable take precedence.

        See http://docs.gunicorn.org/en/stable/settings.html
        """
        for key, value in iteritems(self.options):
            key = key.lower()
            if key in self.cfg.settings and value is not None:
                self.cfg.set(key, value)
        self.load_vars()
Beispiel #18
0
 def add(self, metric_name, metric_type, value, **tags):
     tags_hash = hash(frozenset(six.iteritems(tags)))
     self.data[metric_name, tags_hash] = (metric_type, value, tags)
Beispiel #19
0
 def load_config(self):
     """The initial setup of the standalone application."""
     for key, value in iteritems(self._options):
         if value is not None and key in self.cfg.settings:
             self.cfg.set(key, value)
Beispiel #20
0
 def __iter__(self):
     for (metric_name, _), (metric_type, value,
                            tags) in six.iteritems(self.data):
         yield self.Item(metric_name, metric_type, tags, value)
Beispiel #21
0
 def load_config(self):
     for key, value in iteritems(self.options):
         key = key.lower()
         if key in self.cfg.settings and value is not None:
             self.cfg.set(key, value)
Beispiel #22
0
 def load_config(self):
     config = dict([(key, value) for key, value in iteritems(self.options)
                    if key in self.cfg.settings and value is not None])
     config['logger_class'] = GunicornLogger
     for key, value in iteritems(config):
         self.cfg.set(key.lower(), value)
Beispiel #23
0
 def load_config(self):
     """Load the provided configuration if one was provided."""
     config = dict([(key, value) for key, value in iteritems(self.options)
                    if key in self.cfg.settings and value is not None])
     for key, value in iteritems(config):
         self.cfg.set(key.lower(), value)
 def load_config(self):
     config = dict([(key, value) for key, value in iteritems(self.options)
                    if key in self.cfg.settings and value is not None])
     config['when_ready'] = when_ready
     for key, value in iteritems(config):
         self.cfg.set(key.lower(), value)
Beispiel #25
0
 def load_config(self):
     config = dict([(key, value) for key, value in iteritems(self.gunicorn_config)
                    if key in self.cfg.settings and value is not None])
     for key, value in iteritems(config):
         self.cfg.set(key.lower(), value)
Beispiel #26
0
 def load_config(self):
     for key, value in iteritems(self.__options):
         if key in self.cfg.settings and value is not None:
             self.cfg.set(key.lower(), value)
         elif key == "cors" and value is not None:
             CORS(self.__app, **value)
Beispiel #27
0
 def load_config(self):
     for key, value in iteritems(self.options):
         if key in self.cfg.settings:
             self.cfg.set(key.lower(), value)
Beispiel #28
0
 def load_config(self):
     config = dict([(key, value) for key, value in iteritems(self.options)
                    if key in self.cfg.settings and value is not None and value.__class__.__name__ == 'str'])
     for key, value in iteritems(config):
         self.cfg.set(key.lower(), value)
Beispiel #29
0
 def load_config(self):
     for key, value in iteritems(self.options):
         if key in self.cfg.settings:
             self.cfg.set(key.lower(), value)