def main():
    config.setup(os.environ.get('ARTIFACTS_COREPY_CONF',
                                '/etc/artifacts_corepy/artifacts_corepy.conf'),
                 dir_path=os.environ.get(
                     'ARTIFACTS_COREPY_CONF_DIR',
                     '/etc/artifacts_corepy/artifacts_corepy.conf.d'))
    mylogger.setup()
    tz_info = timezone(CONF.timezone)
    try:
        if CONF.platform_timezone:
            prefix = 'ENV@'
            value = CONF.platform_timezone
            if value.startswith(prefix):
                env_name = value[len(prefix):]
                value = os.getenv(env_name, default='')
            tz_info = timezone(value)
    except Exception as e:
        LOG.exception(e)
    scheduler = BlockingScheduler(jobstores=jobstores,
                                  executors=executors,
                                  job_defaults=job_defaults,
                                  timezone=tz_info)
    scheduler.add_job(cleanup_cached_dir, 'cron', hour='*')
    scheduler.add_job(rotate_log, 'cron', hour=3, minute=5)
    try:
        scheduler.start()
    except (KeyboardInterrupt, SystemExit):
        pass
예제 #2
0
# coding=utf-8

from __future__ import absolute_import

import os
import logging
from logging.handlers import WatchedFileHandler
import multiprocessing

from talos.core import config as __config

__config.setup(os.environ.get('WECUBE_PLUGINS_ITSDANGEROUS_CONF',
                              './etc/wecube_plugins_itsdangerous.conf'),
               dir_path=os.environ.get(
                   'WECUBE_PLUGINS_ITSDANGEROUS_CONF_DIR',
                   './etc/wecube_plugins_itsdangerous.conf.d'))
CONF = __config.CONF

name = CONF.locale_app
proc_name = CONF.locale_app
bind = '%s:%d' % (CONF.server.bind, CONF.server.port)
backlog = CONF.server.backlog
# 超时
timeout = 30
# 进程数
workers = multiprocessing.cpu_count() * 2
# 指定每个进程开启的线程数
threads = 1
debug = False
daemon = False
# 日志级别,这个日志级别指的是错误日志的级别,而访问日志的级别无法设置
예제 #3
0
파일: gunicorn.py 프로젝트: leipengkai/test
# coding=utf-8

from __future__ import absolute_import

import os
import logging
from logging.handlers import WatchedFileHandler
import multiprocessing

from talos.core import config as __config

__config.setup(os.environ.get('CMS_CONF', './etc/cms.conf'),
               dir_path=os.environ.get('CMS_CONF_DIR', './etc/cms.conf.d'))
CONF = __config.CONF

name = CONF.locale_app
proc_name = CONF.locale_app
bind = '%s:%d' % (CONF.server.bind, CONF.server.port)
backlog = CONF.server.backlog
# 超时
timeout = 30
# 进程数
workers = multiprocessing.cpu_count() * 2
# 指定每个进程开启的线程数
threads = 1
debug = False
daemon = False
# 日志级别,这个日志级别指的是错误日志的级别,而访问日志的级别无法设置
loglevel = CONF.log.level.lower()
# 访问日志文件的路径
accesslog = "/dev/null"
예제 #4
0
# coding=utf-8

from __future__ import absolute_import

import os
import logging
from logging.handlers import WatchedFileHandler
import multiprocessing

from talos.core import config as __config

__config.setup(os.environ.get('WECUBEK8S_CONF',
                              '/etc/wecubek8s/wecubek8s.conf'),
               dir_path=os.environ.get('WECUBEK8S_CONF_DIR',
                                       '/etc/wecubek8s/wecubek8s.conf.d'))
CONF = __config.CONF

name = CONF.locale_app
proc_name = CONF.locale_app
bind = '%s:%d' % (CONF.server.bind, CONF.server.port)
backlog = CONF.server.backlog
# 超时
timeout = 30
# 进程数
workers = max(multiprocessing.cpu_count() * 2, 8)
# 指定每个进程开启的线程数
threads = 1
debug = False
daemon = False
# 日志级别,这个日志级别指的是错误日志的级别,而访问日志的级别无法设置
loglevel = CONF.log.level.lower()
# coding=utf-8

from __future__ import absolute_import

import os
import logging
from logging.handlers import WatchedFileHandler
import multiprocessing

from talos.core import config as __config

__config.setup(os.environ.get('ARTIFACTS_COREPY_CONF',
                              '/etc/artifacts_corepy/artifacts_corepy.conf'),
               dir_path=os.environ.get(
                   'ARTIFACTS_COREPY_CONF_DIR',
                   '/etc/artifacts_corepy/artifacts_corepy.conf.d'))
CONF = __config.CONF

name = CONF.locale_app
proc_name = CONF.locale_app
bind = '%s:%d' % (CONF.server.bind, CONF.server.port)
backlog = CONF.server.backlog
# 超时
timeout = 30
# 进程数
workers = 4  # multiprocessing.cpu_count() * 2
# 指定每个进程开启的线程数
threads = 1
debug = False
daemon = False
# 日志级别,这个日志级别指的是错误日志的级别,而访问日志的级别无法设置