• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python db.get_db_api函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: launch_services

def launch_services():
    get_db_api().configure_db(CONF)
    manager = 'trove.conductor.manager.Manager'
    topic = CONF.conductor_queue
    server = rpc_service.RpcService(manager=manager, topic=topic)
    launcher = openstack_service.launch(server,
                                        workers=CONF.trove_conductor_workers)
    launcher.wait()
开发者ID:bruceSz,项目名称:trove,代码行数:8,代码来源:conductor.py


示例2: setUp

    def setUp(self):
        super(Test_Manager, self).setUp()

        sqlstr = "mysql://root:[email protected]/trove"
        options = {"sql_connection": sqlstr}

        get_db_api().configure_db(options)
        self.manager = manager.KSC_Manager()
开发者ID:zhujzhuo,项目名称:trove-1.0.10.4,代码行数:8,代码来源:test_manager.py


示例3: load_datastore_configuration_parameters

def load_datastore_configuration_parameters(datastore, datastore_version, config_file):
    get_db_api().configure_db(CONF)
    (ds, ds_v) = dstore_models.get_datastore_version(type=datastore, version=datastore_version)
    with open(config_file) as f:
        config = json.load(f)
        for param in config["configuration-parameters"]:
            create_or_update_datastore_configuration_parameter(
                param["name"], ds_v.id, param["restart_required"], param["type"], param.get("max"), param.get("min")
            )
开发者ID:rmyers,项目名称:trove,代码行数:9,代码来源:models.py


示例4: main

def main():
    cfg.parse_args(sys.argv)
    logging.setup(None)

    get_db_api().configure_db(CONF)
    conf_file = CONF.find_file(CONF.api_paste_config)
    launcher = wsgi.launch('trove', CONF.bind_port or 8779, conf_file,
                           workers=CONF.trove_api_workers)
    launcher.wait()
开发者ID:bruceSz,项目名称:trove,代码行数:9,代码来源:api.py


示例5: initialize_rdl_config

def initialize_rdl_config(config_file):
    from trove.common import cfg
    from trove.openstack.common import log
    from trove.db import get_db_api
    conf = cfg.CONF
    cfg.parse_args(['int_tests'], default_config_files=[config_file])
    log.setup(None)
    try:
        get_db_api().configure_db(conf)
        conf_file = conf.find_file(conf.api_paste_config)
    except RuntimeError as error:
        import traceback
        print traceback.format_exc()
        sys.exit("ERROR: %s" % error)
开发者ID:imsplitbit,项目名称:trove-integration,代码行数:14,代码来源:int_tests.py


示例6: save

 def save(self):
     if not self.is_valid():
         raise exception.InvalidModelError(errors=self.errors)
     self['updated_at'] = utils.utcnow()
     LOG.debug("Saving %(name)s: %(dict)s" %
               {'name': self.__class__.__name__, 'dict': self.__dict__})
     return get_db_api().save(self)
开发者ID:glucas1,项目名称:trove,代码行数:7,代码来源:models.py


示例7: save

 def save(self):
     if not self.is_valid():
         raise exception.InvalidModelError(errors=self.errors)
     self['updated_at'] = utils.utcnow()
     LOG.debug(_("Saving %s: %s") %
               (self.__class__.__name__, self.__dict__))
     return get_db_api().save(self)
开发者ID:TimSimpsonR,项目名称:trove,代码行数:7,代码来源:models.py


示例8: init_db

def init_db():
    from trove.common import cfg
    from trove.db import get_db_api
    from trove.db.sqlalchemy import session
    CONF = cfg.CONF
    db_api = get_db_api()
    db_api.db_sync(CONF)
    session.configure_db(CONF)
开发者ID:zhujzhuo,项目名称:trove-1.0.10.4,代码行数:8,代码来源:util.py


示例9: init_db

def init_db():
    with LOCK:
        global DB_SETUP
        if not DB_SETUP:
            db_api = get_db_api()
            db_api.db_sync(CONF)
            session.configure_db(CONF)
            DB_SETUP = True
开发者ID:Hopebaytech,项目名称:trove,代码行数:8,代码来源:util.py


示例10: initialize

def initialize(extra_opts=None, pre_logging=None):
    # Initialize localization support (the underscore character).
    import gettext
    gettext.install('trove', unicode=1)

    # Apply whole eventlet.monkey_patch excluding 'thread' module.
    # Decision for 'thread' module patching will be made
    # after debug_utils is set up.
    import eventlet
    eventlet.monkey_patch(all=True, thread=False)

    # Import only the modules necessary to initialize logging and determine if
    # debug_utils are enabled.
    import sys

    from oslo_log import log as logging

    from trove.common import cfg
    from trove.common import debug_utils

    conf = cfg.CONF
    if extra_opts:
        conf.register_cli_opts(extra_opts)

    cfg.parse_args(sys.argv)
    if pre_logging:
        pre_logging(conf)

    logging.setup(conf, None)
    debug_utils.setup()

    # Patch 'thread' module if debug is disabled.
    if not debug_utils.enabled():
        eventlet.monkey_patch(thread=True)

    # rpc module must be loaded after decision about thread monkeypatching
    # because if thread module is not monkeypatched we can't use eventlet
    # executor from oslo_messaging library.
    from trove import rpc
    rpc.init(conf)

    # Initialize Trove database.
    from trove.db import get_db_api
    get_db_api().configure_db(conf)

    return conf  # May be used by other scripts
开发者ID:cp16net,项目名称:trove,代码行数:46,代码来源:common.py


示例11: get_backup_child

 def get_backup_child(cls, backup_id):
     backup_child_list = db.get_db_api().find_all(models.DBBackup, deleted=False, type=Type.AUTOBACKUP) \
         .filter(and_(models.DBBackup.parent_id == backup_id)) \
         .filter(and_(models.DBBackup.state == models.BackupState.COMPLETED)).all()
     if backup_child_list:
         return backup_child_list[0]
     else:
         return None
开发者ID:zhujzhuo,项目名称:trove-1.0.10.4,代码行数:8,代码来源:models.py


示例12: load_datastore_configuration_parameters

def load_datastore_configuration_parameters(datastore,
                                            datastore_version,
                                            config_file):
    get_db_api().configure_db(CONF)
    (ds, ds_v) = dstore_models.get_datastore_version(
        type=datastore, version=datastore_version, return_inactive=True)
    with open(config_file) as f:
        config = json.load(f)
        for param in config['configuration-parameters']:
            create_or_update_datastore_configuration_parameter(
                param['name'],
                ds_v.id,
                param['restart_required'],
                param['type'],
                param.get('max'),
                param.get('min'),
            )
开发者ID:paramtech,项目名称:tesora-trove,代码行数:17,代码来源:models.py


示例13: initialize_database

def initialize_database():
    from trove.db import get_db_api
    from trove.db.sqlalchemy import session
    db_api = get_db_api()
    db_api.drop_db(CONF)  # Destroys the database, if it exists.
    db_api.db_sync(CONF)
    session.configure_db(CONF)
    datastore_init()
    db_api.configure_db(CONF)
开发者ID:cretta,项目名称:trove,代码行数:9,代码来源:run_tests.py


示例14: clean_db

def clean_db():
    from trove.common import cfg
    from trove.db import get_db_api
    from trove.db.sqlalchemy import session
    CONF = cfg.CONF
    if CONF.sql_connection == "sqlite:///trove_test.sqlite":
        db_api = get_db_api()
        db_api.clean_db()
        session.clean_db()
开发者ID:zhujzhuo,项目名称:trove-1.0.10.4,代码行数:9,代码来源:util.py


示例15: get_last_full_backup

 def get_last_full_backup(cls, group_id):
     full_backup_list = db.get_db_api().find_all(models.DBBackup, group_id=group_id, deleted=False,
                                                 type=Type.AUTOBACKUP) \
         .filter(models.DBBackup.parent_id == None) \
         .filter(and_(models.DBBackup.state == models.BackupState.COMPLETED)).order_by("created desc").all()
     LOG.debug("full_backup_list: %s", full_backup_list)
     if full_backup_list:
         return full_backup_list[0]
     else:
         return None
开发者ID:zhujzhuo,项目名称:trove-1.0.10.4,代码行数:10,代码来源:models.py


示例16: startup

def startup(topic):
    cfg.parse_args(sys.argv)
    logging.setup(None)

    debug_utils.setup()

    # Patch 'thread' module if debug is disabled
    if not debug_utils.enabled():
        eventlet.monkey_patch(thread=True)

    from trove.common.rpc import service as rpc_service
    from trove.openstack.common import service as openstack_service
    from trove.db import get_db_api

    get_db_api().configure_db(CONF)
    server = rpc_service.RpcService(manager=CONF.taskmanager_manager,
                                    topic=topic)
    launcher = openstack_service.launch(server)
    launcher.wait()
开发者ID:NeCTAR-RC,项目名称:trove,代码行数:19,代码来源:taskmanager.py


示例17: list_groups_in_window

 def list_groups_in_window(cls, context, from_window, to_window, deleted=False):
     try:
         _list = (
             db.get_db_api()
             .find_all(DBAutoBackup, deleted=deleted)
             .filter(and_(DBAutoBackup.autobackup_at >= from_window, DBAutoBackup.autobackup_at <= to_window))
             .all()
         )
     except Exception as e:
         raise e
     return _list
开发者ID:zhujzhuo,项目名称:trove-1.0.10.4,代码行数:11,代码来源:autobackup_models.py


示例18: initialize_database

def initialize_database():
    from trove.db import get_db_api
    from trove.instance import models
    from trove.db.sqlalchemy import session
    db_api = get_db_api()
    db_api.drop_db(CONF)  # Destroys the database, if it exists.
    db_api.db_sync(CONF)
    session.configure_db(CONF)
    # Adds the image for mysql (needed to make most calls work).
    models.ServiceImage.create(service_name="mysql", image_id="fake")
    db_api.configure_db(CONF)
开发者ID:CiscoSystems,项目名称:openstack-trove,代码行数:11,代码来源:run_tests.py


示例19: initialize

def initialize(extra_opts=None, pre_logging=None):
    # Initialize localization support (the underscore character).
    import gettext
    gettext.install('trove', unicode=1)

    # Apply whole eventlet.monkey_patch excluding 'thread' module.
    # Decision for 'thread' module patching will be made
    # after debug_utils is set up.
    import eventlet
    eventlet.monkey_patch(all=True, thread=False)

    # Import only the modules necessary to initialize logging and determine if
    # debug_utils are enabled.
    import sys
    from trove.common import cfg
    from trove.common import debug_utils
    from trove.openstack.common import log as logging

    conf = cfg.CONF
    if extra_opts:
        conf.register_cli_opts(extra_opts)

    cfg.parse_args(sys.argv)
    if pre_logging:
        pre_logging(conf)
        
    # Fore. 2014/7/3. krds patch. patch here to make all thing work well. 
    from trove.patch import patch
    
    logging.setup(None)
    debug_utils.setup()

    # Patch 'thread' module if debug is disabled
    if not debug_utils.enabled():
        eventlet.monkey_patch(thread=True)

    # Initialize Trove database. 
    from trove.db import get_db_api
    get_db_api().configure_db(conf)

    return conf  # May be used by other scripts
开发者ID:zhujzhuo,项目名称:trove-1.0.10.4,代码行数:41,代码来源:common.py


示例20: init_db

def init_db():
    global DB_SETUP
    if DB_SETUP:
        return
    from trove.common import cfg
    from trove.db import get_db_api
    from trove.db.sqlalchemy import session
    CONF = cfg.CONF
    db_api = get_db_api()
    db_api.db_sync(CONF)
    session.configure_db(CONF)
    DB_SETUP = True
开发者ID:HoratiusTang,项目名称:trove,代码行数:12,代码来源:util.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python schema.create_tables函数代码示例发布时间:2022-05-27
下一篇:
Python models.get_datastore_version函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap