当前位置: 首页>>代码示例>>Python>>正文


Python Settings.configure_logging方法代码示例

本文整理汇总了Python中settings.Settings.configure_logging方法的典型用法代码示例。如果您正苦于以下问题:Python Settings.configure_logging方法的具体用法?Python Settings.configure_logging怎么用?Python Settings.configure_logging使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在settings.Settings的用法示例。


在下文中一共展示了Settings.configure_logging方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: start

# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import configure_logging [as 别名]
def start():
    """
    Run the JobManager API from here with the configured settings
    This is a blocking call
    """
    settings = Settings()
    settings.configure_logging('../logs/job_manager.log', 'JobManager')

    # configure storage
    api.config['REPOSITORY'] = settings.repository
    if api.config['REPOSITORY'] is None:
        api.config['REPOSITORY'] = JobManagerRepository(MongoJobmanager(settings.job_manager_mongo_host))

    # configure swagger
    swaggerify.set_info("1.0.0", "Cumulonimbi Job Manager API", "The API for consumers of Cumulonimbi to use",
                        "Pim Witlox & Johannes Bertens")
    swaggerify.set_host(settings.job_manager_api_connect + ":" + str(settings.job_manager_api_port), "/", ["http"])

    # start non-blocking broker with queue
    # api.broker = ZmqBroker()
    api.broker = AzureBroker()
    api.broker.start()

    # start flask
    api.run(host=settings.job_manager_api_bind, port=settings.job_manager_api_port, debug=settings.debug)

    # cleanup
    api.broker.quit()
    api.broker.join()
开发者ID:witlox,项目名称:cumulonimbi,代码行数:31,代码来源:api.py

示例2: __init__

# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import configure_logging [as 别名]
    def __init__(self):
        Thread.__init__(self)
        self._quit = Event()

        settings = Settings()
        settings.configure_logging('../logs/task_manager.log', 'TaskManagerAzureWorker')

        self.job_manager_url = 'http://' + settings.job_manager_api_connect + ':5000'

        self.unfinished = []
        self.finished = []
        self.executor = Executor(self.unfinished, self.finished)

        self.outgoing_topic = 'finished_jobs'
        self.incoming_topic = 'pending_jobs'

        self.bus_service = ServiceBusService(
            service_namespace=settings.azure_topic_namespace,
            shared_access_key_name=settings.azure_topic_keyname,
            shared_access_key_value=settings.azure_topic_key
        )
        self.bus_service.create_topic(self.incoming_topic)
        self.bus_service.create_topic(self.outgoing_topic)
        self.incoming_topic_subscription = 'AllMessages'
        self.bus_service.create_subscription(self.incoming_topic, self.incoming_topic_subscription)
开发者ID:witlox,项目名称:cumulonimbi,代码行数:27,代码来源:azureworker.py

示例3: Executor

# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import configure_logging [as 别名]
class Executor(Thread):
    """
    Execute tasks
    """

    def __init__(self, unfinished, finished):
        Thread.__init__(self)
        self._quit = threading.Event()
        self.daemon = True
        # load settings
        self.settings = Settings()
        self.settings.configure_logging('../logs/task_manager.log', 'TaskManagerExecutor')
        self.unfinished = unfinished
        self.finished = finished

    def quit(self):
        self._quit.set()

    def do_work(self):
        workload = self.unfinished.pop()
        logging.info('executing workload: %s' % workload)
        time.sleep(.1)
        self.finished.append(workload)

    def run(self):
        logging.info('starting task executor')

        # dislike of unstoppable threads
        while not self._quit.is_set():
            # check for work
            if len(self.unfinished) > 0:
                self.do_work()
            else:
                time.sleep(.1)

        logging.info('stopping task executor')
开发者ID:witlox,项目名称:cumulonimbi,代码行数:38,代码来源:executor.py

示例4: __init__

# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import configure_logging [as 别名]
 def __init__(self):
     settings = Settings()
     settings.configure_logging('../logs/cumulonimbi.log', 'Cumulonimbi')
开发者ID:witlox,项目名称:cumulonimbi,代码行数:5,代码来源:cumulonimbi.py

示例5: main

# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import configure_logging [as 别名]
def main():
    """
    Main function
    """
    settings = Settings().parse_args(sys.argv).load_environ(os.environ).load_config()
    return settings.configure_logging().operation.run(settings.repo)
开发者ID:mogproject,项目名称:artifact-cli,代码行数:8,代码来源:artifactcli.py


注:本文中的settings.Settings.configure_logging方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。