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


Python simport.load函数代码示例

本文整理汇总了Python中monasca_common.simport.simport.load函数的典型用法代码示例。如果您正苦于以下问题:Python load函数的具体用法?Python load怎么用?Python load使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: test_good_load_local

        def test_good_load_local(self):
            method = simport.load(PWD + "|localmodule:Foo.method_a")
            import localmodule

            self.assertEqual(method, localmodule.Foo.method_a)
            self.assertEqual(localmodule.function_a,
                             simport.load("localmodule:function_a"))
开发者ID:openstack,项目名称:monasca-common,代码行数:7,代码来源:test_simport.py

示例2: __init__

    def __init__(self):

        super(Alarming, self).__init__()

        self.events_message_queue = simport.load(
            cfg.CONF.messaging.driver)('events')

        self.alarm_state_transitions_message_queue = simport.load(
            cfg.CONF.messaging.driver)('alarm-state-transitions')
开发者ID:artur-ba,项目名称:monasca-api,代码行数:9,代码来源:alarming.py

示例3: __init__

    def __init__(self):

        super(Alarming, self).__init__()

        self.events_message_queue = simport.load(
            cfg.CONF.messaging.driver)(cfg.CONF.kafka.events_topic)

        self.alarm_state_transitions_message_queue = simport.load(
            cfg.CONF.messaging.driver)(cfg.CONF.kafka.alarm_state_transitions_topic)
开发者ID:jgrassler,项目名称:monasca-api,代码行数:9,代码来源:alarming.py

示例4: __init__

    def __init__(self):

        super(Notifications, self).__init__()

        self._region = cfg.CONF.region
        self._notifications_repo = simport.load(
            cfg.CONF.repositories.notifications_driver)()
        self._notification_method_type_repo = simport.load(
            cfg.CONF.repositories.notification_method_type_driver)()
        self.valid_periods = cfg.CONF.valid_notification_periods
开发者ID:openstack,项目名称:monasca-api,代码行数:10,代码来源:notifications.py

示例5: main

def main():
    log.register_options(cfg.CONF)
    log.set_defaults()
    cfg.CONF(sys.argv[1:], project='monasca', prog='persister')
    log.setup(cfg.CONF, "monasca-persister")

    """Start persister."""

    metric_repository = simport.load(cfg.CONF.repositories.metrics_driver)
    alarm_state_history_repository = simport.load(cfg.CONF.repositories.alarm_state_history_driver)

    # Add processors for metrics topic
    for proc in range(0, cfg.CONF.kafka_metrics.num_processors):
        processors.append(multiprocessing.Process(
                target=start_process, args=(metric_repository, cfg.CONF.kafka_metrics)))

    # Add processors for alarm history topic
    for proc in range(0, cfg.CONF.kafka_alarm_history.num_processors):
        processors.append(multiprocessing.Process(
                target=start_process, args=(alarm_state_history_repository, cfg.CONF.kafka_alarm_history)))

    # Start
    try:
        LOG.info('''

               _____
              /     \   ____   ____ _____    ______ ____ _____
             /  \ /  \ /  _ \ /    \\\__  \  /  ___// ___\\\__  \\
            /    Y    (  <_> )   |  \/ __ \_\___ \\  \___ / __  \\_
            \____|__  /\____/|___|  (____  /____  >\___  >____  /
                    \/            \/     \/     \/     \/     \/
            __________                    .__          __
            \______   \ ___________  _____|__| _______/  |_  ___________
             |     ___// __ \_  __ \/  ___/  |/  ___/\   __\/ __ \_  __ \\
             |    |   \  ___/|  | \/\___ \|  |\___ \  |  | \  ___/|  | \/
             |____|    \___  >__|  /____  >__/____  > |__|  \___  >__|
                           \/           \/        \/            \/

        ''')
        for process in processors:
            process.start()

        # The signal handlers must be added after the processes start otherwise
        # they run on all processes
        signal.signal(signal.SIGCHLD, clean_exit)
        signal.signal(signal.SIGINT, clean_exit)
        signal.signal(signal.SIGTERM, clean_exit)

        while True:
            time.sleep(10)

    except Exception:
        LOG.exception('Error! Exiting.')
        clean_exit(signal.SIGKILL)
开发者ID:sapcc,项目名称:monasca-persister,代码行数:54,代码来源:persister.py

示例6: __init__

    def __init__(self):

        super(Notifications, self).__init__()

        self._region = cfg.CONF.region
        self._default_authorized_roles = cfg.CONF.security.default_authorized_roles
        self._get_notifications_authorized_roles = (
            cfg.CONF.security.default_authorized_roles + cfg.CONF.security.read_only_authorized_roles
        )
        self._notifications_repo = simport.load(cfg.CONF.repositories.notifications_driver)()
        self._notification_method_type_repo = simport.load(cfg.CONF.repositories.notification_method_type_driver)()
        self.valid_periods = cfg.CONF.valid_notification_periods
开发者ID:sapcc,项目名称:monasca-api,代码行数:12,代码来源:notifications.py

示例7: __init__

    def __init__(self):
        try:
            super(AlarmsStateHistory, self).__init__()
            self._region = cfg.CONF.region
            self._alarms_repo = simport.load(
                cfg.CONF.repositories.alarms_driver)()
            self._metrics_repo = simport.load(
                cfg.CONF.repositories.metrics_driver)()

        except Exception as ex:
            LOG.exception(ex)
            raise exceptions.RepositoryException(ex)
开发者ID:openstack,项目名称:monasca-api,代码行数:12,代码来源:alarms.py

示例8: __init__

    def __init__(self):
        try:
            super(AlarmsStateHistory, self).__init__()
            self._region = cfg.CONF.region
            self._get_alarms_authorized_roles = (
                cfg.CONF.security.default_authorized_roles + cfg.CONF.security.read_only_authorized_roles
            )
            self._alarms_repo = simport.load(cfg.CONF.repositories.alarms_driver)()
            self._metrics_repo = simport.load(cfg.CONF.repositories.metrics_driver)()

        except Exception as ex:
            LOG.exception(ex)
            raise exceptions.RepositoryException(ex)
开发者ID:sapcc,项目名称:monasca-api,代码行数:13,代码来源:alarms.py

示例9: __init__

    def __init__(self):
        try:
            self._metrics_repo = simport.load(
                CONF.repositories.metrics_driver)

        except Exception as ex:
            LOG.exception(ex)
            raise
开发者ID:jgrassler,项目名称:monasca-api,代码行数:8,代码来源:metrics_db_check.py

示例10: prepare_processes

def prepare_processes(conf, repo_driver):
    if conf.num_processors > 0:
        repository = simport.load(repo_driver)
        for proc in range(0, conf.num_processors):
            processors.append(multiprocessing.Process(
                target=start_process, args=(repository, conf)))
    else:
        LOG.warning("Number of processors (num_processors) is {}".format(
            conf.num_processors))
开发者ID:openstack,项目名称:monasca-persister,代码行数:9,代码来源:persister.py

示例11: __init__

    def __init__(self):
        try:
            super(AlarmDefinitions, self).__init__()
            self._region = cfg.CONF.region
            self._alarm_definitions_repo = simport.load(
                cfg.CONF.repositories.alarm_definitions_driver)()

        except Exception as ex:
            LOG.exception(ex)
            raise exceptions.RepositoryException(ex)
开发者ID:openstack,项目名称:monasca-api,代码行数:10,代码来源:alarm_definitions.py

示例12: test_good_load_external

    def test_good_load_external(self):
        method = simport.load("tests/external|" "external.externalmodule:Blah.method_b")

        self.assertTrue("external.externalmodule" in sys.modules)
        old = sys.modules["external.externalmodule"]
        import external.externalmodule

        self.assertEqual(external.externalmodule, sys.modules["external.externalmodule"])
        self.assertEqual(old, external.externalmodule)
        self.assertEqual(method, external.externalmodule.Blah.method_b)
开发者ID:sapcc,项目名称:monasca-common,代码行数:10,代码来源:test_simport.py

示例13: __init__

    def __init__(self):
        try:
            super(Metrics, self).__init__()
            self._region = cfg.CONF.region
            self._default_authorized_roles = (
                cfg.CONF.security.default_authorized_roles)
            self._delegate_authorized_roles = (
                cfg.CONF.security.delegate_authorized_roles)
            self._post_metrics_authorized_roles = (
                cfg.CONF.security.default_authorized_roles +
                cfg.CONF.security.agent_authorized_roles)
            self._message_queue = simport.load(cfg.CONF.messaging.driver)(
                'metrics')
            self._metrics_repo = simport.load(
                cfg.CONF.repositories.metrics_driver)()

        except Exception as ex:
            LOG.exception(ex)
            raise falcon.HTTPInternalServerError('Service unavailable',
                                                 ex.message)
开发者ID:bigluster,项目名称:monasca-api,代码行数:20,代码来源:metrics.py

示例14: test_good_load_external

        def test_good_load_external(self):

            method = simport.load(PWD + "/external|external.externalmodule:Blah.method_b")

            self.assertTrue('external.externalmodule' in sys.modules)
            old = sys.modules['external.externalmodule']
            import external.externalmodule

            self.assertEqual(external.externalmodule,
                             sys.modules['external.externalmodule'])
            self.assertEqual(old, external.externalmodule)
            self.assertEqual(method, external.externalmodule.Blah.method_b)
开发者ID:openstack,项目名称:monasca-common,代码行数:12,代码来源:test_simport.py

示例15: __init__

    def __init__(self):
        try:
            super(AlarmsCount, self).__init__()
            self._region = cfg.CONF.region
            self._default_authorized_roles = (
                cfg.CONF.security.default_authorized_roles)
            self._alarms_repo = simport.load(
                cfg.CONF.repositories.alarms_driver)()

        except Exception as ex:
            LOG.exception(ex)
            raise exceptions.RepositoryException(ex)
开发者ID:bigluster,项目名称:monasca-api,代码行数:12,代码来源:alarms.py


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