Exemplo n.º 1
0
    def test_loading_module(self):
        plug_into(self.tmp_dir)

        plugin_mod = import_module('test')
        must_be_true = plugin_mod.perform_init()

        self.assertTrue(must_be_true)
Exemplo n.º 2
0
    def test_loading_module(self):
        plug_into(self.tmp_dir)

        plugin_mod = import_module("test")
        must_be_true = plugin_mod.perform_init()

        self.assertTrue(must_be_true)
Exemplo n.º 3
0
    def test_loading_file(self):
        plug_into(self.tmp_dir)

        plugin_mod = import_module('test.plugin')
        must_be_true, msg = plugin_mod.perform_operation('test')

        self.assertTrue(must_be_true)
        self.assertEqual('test', msg)
Exemplo n.º 4
0
    def test_loading_file(self):
        plug_into(self.tmp_dir)

        plugin_mod = import_module("test.plugin")
        must_be_true, msg = plugin_mod.perform_operation("test")

        self.assertTrue(must_be_true)
        self.assertEqual("test", msg)
Exemplo n.º 5
0
def bootstrap_api():
    # Persist the coordinator_uri and personality to ConfigCache
    config = WorkerConfiguration(PERSONALITY, platform.node(), COORDINATOR_URI)
    config_cache.set_config(config)

    personality_module = 'meniscus.personas.{0}.app'.format(PERSONALITY)
    _LOG.info(
        'loading default personality module: {0}'.format(personality_module))

    #load the personality module as a plug in
    plugin_mod = import_module(personality_module)

    #start up the api from the specified personality_module
    return plugin_mod.start_up()
Exemplo n.º 6
0
def bootstrap_api():
    # Persist the coordinator_uri and personality to ConfigCache
    config = WorkerConfiguration(PERSONALITY, platform.node(),
                                 COORDINATOR_URI)
    config_cache.set_config(config)

    personality_module = 'meniscus.personas.{0}.app'.format(PERSONALITY)
    _LOG.info('loading default personality module: {0}'
        .format(personality_module))

    #load the personality module as a plug in
    plugin_mod = import_module(personality_module)

    #start up the api from the specified personality_module
    return plugin_mod.start_up()
Exemplo n.º 7
0
def bootstrap_api():

    #if the configuration exists in the cache,
    # retrieve the personality module
    config = config_cache.get_config()

    if config:
        personality_module = config.personality_module
    else:
        personality_module = DEFAULT_PERSONALITY_MODULE

    #load the personality module as a plug in
    plugin_mod = import_module(personality_module)

    #start up the api from the specified personality_module
    return plugin_mod.start_up()
Exemplo n.º 8
0
def bootstrap_api(global_config, **local_conf):

    #if the configuration exists in the cache,
    # retrieve the personality module
    config = config_cache.get_config()

    if config:
        personality_module = config.personality_module
        _LOG.info('loading personality module from config: {0}'
                  .format(personality_module))
    else:
        personality_module = DEFAULT_PERSONALITY_MODULE
        _LOG.info('loading default personality module: {0}'
                  .format(personality_module))

    #load the personality module as a plug in
    plugin_mod = import_module(personality_module)

    #start up the api from the specified personality_module
    return plugin_mod.start_up()
Exemplo n.º 9
0
def bootstrap_api(global_config, **local_conf):

    #if the configuration exists in the cache,
    # retrieve the personality module
    config = config_cache.get_config()

    if config:
        personality_module = config.personality_module
        _LOG.info('loading personality module from config: {0}'.format(
            personality_module))
    else:
        personality_module = DEFAULT_PERSONALITY_MODULE
        _LOG.info('loading default personality module: {0}'.format(
            personality_module))

    #load the personality module as a plug in
    plugin_mod = import_module(personality_module)

    #start up the api from the specified personality_module
    return plugin_mod.start_up()
Exemplo n.º 10
0

try:
    config.init_config()
except config.cfg.ConfigFilesNotFoundError as ex:
    _LOG.exception(ex.message)

conf = config.get_config()

# Handler registration
_DATASOURCE_HANDLERS = handler.DatasourceHandlerManager()


if conf.coordinator_db.active:
    #create coordinator_db handler
    coordinator_db_module = import_module(
        'meniscus.data.adapters.{0}'.format(conf.coordinator_db.adapter_name))

    coordinator_db_handler = coordinator_db_module.NamedDatasourceHandler(
        conf.coordinator_db)
    _DATASOURCE_HANDLERS.register(COORDINATOR_DB, coordinator_db_handler)
    #if handler is not active, register as None
else:
    _DATASOURCE_HANDLERS.register(COORDINATOR_DB, None)


if conf.short_term_store.active:
    #create short_term_store handler
    short_term_store_module = import_module(
        'meniscus.data.adapters.{0}'.format(
            conf.short_term_store.adapter_name))
    short_term_store_handler = short_term_store_module.NamedDatasourceHandler(
Exemplo n.º 11
0

try:
    config.init_config()
except config.cfg.ConfigFilesNotFoundError as ex:
    _LOG.exception(ex.message)

conf = config.get_config()

# Handler registration
_DATASOURCE_HANDLERS = handler.DatasourceHandlerManager()


if conf.coordinator_db.active:
    #create coordinator_db handler
    coordinator_db_module = import_module(
        'meniscus.data.adapters.{0}'.format(conf.coordinator_db.adapter_name))

    coordinator_db_handler = coordinator_db_module.NamedDatasourceHandler(
        conf.coordinator_db)
    _DATASOURCE_HANDLERS.register(COORDINATOR_DB, coordinator_db_handler)
    #if handler is not active, register as None
else:
    _DATASOURCE_HANDLERS.register(COORDINATOR_DB, None)


if conf.short_term_store.active:
    #create short_term_store handler
    short_term_store_module = import_module(
        'meniscus.data.adapters.{0}'.format(
            conf.short_term_store.adapter_name))
    short_term_store_handler = short_term_store_module.NamedDatasourceHandler(