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


Python Log.stop方法代码示例

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


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

示例1: main

# 需要导入模块: from mo_logs import Log [as 别名]
# 或者: from mo_logs.Log import stop [as 别名]
def main():
    try:
        settings = startup.read_settings()
        Log.start(settings.debug)
        with SingleInstance(flavor_id=settings.args.filename):
            constants.set(settings.constants)
            settings.run_interval = Duration(settings.run_interval)
            for u in settings.utility:
                u.discount = coalesce(u.discount, 0)
                # MARKUP drives WITH EXPECTED device MAPPING
                num_ephemeral_volumes = ephemeral_storage[u.instance_type]["num"]
                for i, d in enumerate(d for d in u.drives if not d.device):
                    letter = convert.ascii2char(98 + num_ephemeral_volumes + i)
                    d.device = "/dev/xvd" + letter

            settings.utility = UniqueIndex(["instance_type"], data=settings.utility)
            instance_manager = new_instance(settings.instance)
            m = SpotManager(instance_manager, kwargs=settings)

            if ENABLE_SIDE_EFFECTS:
                m.update_spot_requests(instance_manager.required_utility())

            if m.watcher:
                m.watcher.join()
    except Exception as e:
        Log.warning("Problem with spot manager", cause=e)
    finally:
        Log.stop()
        MAIN_THREAD.stop()
开发者ID:klahnakoski,项目名称:SpotManager,代码行数:31,代码来源:spot_manager.py

示例2: run

# 需要导入模块: from mo_logs import Log [as 别名]
# 或者: from mo_logs.Log import stop [as 别名]
 def run(self, *args, **kwargs):
     # ENSURE THE LOGGING IS CLEANED UP
     try:
         Flask.run(self, *args, **kwargs)
     except BaseException as e:  # MUST CATCH BaseException BECAUSE argparse LIKES TO EXIT THAT WAY, AND gunicorn WILL NOT REPORT
         Log.warning("TUID service shutdown!", cause=e)
     finally:
         Log.stop()
开发者ID:rv404674,项目名称:TUID,代码行数:10,代码来源:app.py

示例3: main

# 需要导入模块: from mo_logs import Log [as 别名]
# 或者: from mo_logs.Log import stop [as 别名]
def main():
    try:
        settings = startup.read_settings()
        constants.set(settings.constants)
        Log.start(settings.debug)
        ETL(settings).setup(settings.instance, settings.utility)
    except Exception as e:
        Log.warning("Problem with setup of ETL", cause=e)
    finally:
        Log.stop()
开发者ID:klahnakoski,项目名称:SpotManager,代码行数:12,代码来源:etl.py

示例4: main

# 需要导入模块: from mo_logs import Log [as 别名]
# 或者: from mo_logs.Log import stop [as 别名]
def main():

    try:
        settings = startup.read_settings()
        constants.set(settings.constants)
        Log.start(settings.debug)

        branches = _get_branches_from_hg(settings.hg)

        es = elasticsearch.Cluster(kwargs=settings.hg.branches).get_or_create_index(kwargs=settings.hg.branches)
        es.add_alias()
        es.extend({"id": b.name + " " + b.locale, "value": b} for b in branches)
        Log.alert("DONE!")
    except Exception as e:
        Log.error("Problem with etl", e)
    finally:
        Log.stop()
开发者ID:rv404674,项目名称:TUID,代码行数:19,代码来源:hg_branches.py

示例5: TUIDService

# 需要导入模块: from mo_logs import Log [as 别名]
# 或者: from mo_logs.Log import stop [as 别名]
    try:
        config = startup.read_settings(
            filename=os.environ.get('TUID_CONFIG')
        )
        constants.set(config.constants)
        Log.start(config.debug)

        service = TUIDService(config.tuid)

        # Log memory info while running
        initial_growth = {}
        objgraph.growth(peak_stats={})
        objgraph.growth(peak_stats=initial_growth)
        service.statsdaemon.initial_growth = initial_growth

        Log.note("Started TUID Service")
        Log.note("Current free memory: {{mem}} Mb", mem=service.statsdaemon.get_free_memory())
    except BaseException as e:  # MUST CATCH BaseException BECAUSE argparse LIKES TO EXIT THAT WAY, AND gunicorn WILL NOT REPORT
        try:
            Log.error("Serious problem with TUID service construction!  Shutdown!", cause=e)
        finally:
            Log.stop()

    if config.flask:
        if config.flask.port and config.args.process_num:
            config.flask.port += config.args.process_num
        Log.note("Running Flask...")
        flask_app.run(**config.flask)

开发者ID:rv404674,项目名称:TUID,代码行数:30,代码来源:app.py


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