def _clean_db(self): lookup_utils.clear_caches() contexts = [get_context(default=False), get_context(default=True)] for ctx in contexts: auth_context.set_ctx(ctx) with mock.patch('mistral.services.security.get_project_id', new=mock.MagicMock(return_value=ctx.project_id)): with db_api.transaction(): db_api.delete_event_triggers() db_api.delete_cron_triggers() db_api.delete_workflow_executions() db_api.delete_task_executions() db_api.delete_action_executions() db_api.delete_workbooks() db_api.delete_workflow_definitions() db_api.delete_environments() db_api.delete_resource_members() db_api.delete_delayed_calls() db_api.delete_scheduled_jobs() sqlite_lock.cleanup() if not cfg.CONF.database.connection.startswith('sqlite'): db_sa_base.get_engine().dispose()
def _clean_db(self): contexts = [ get_context(default=False), get_context(default=True) ] for ctx in contexts: auth_context.set_ctx(ctx) with mock.patch('mistral.services.security.get_project_id', new=mock.MagicMock(return_value=ctx.project_id)): with db_api.transaction(): db_api.delete_event_triggers() db_api.delete_cron_triggers() db_api.delete_workflow_executions() db_api.delete_task_executions() db_api.delete_action_executions() db_api.delete_workbooks() db_api.delete_workflow_definitions() db_api.delete_environments() db_api.delete_resource_members() sqlite_lock.cleanup() if not cfg.CONF.database.connection.startswith('sqlite'): db_sa_base.get_engine().dispose()
def drop_db(): global _facade try: models.Workbook.metadata.drop_all(b.get_engine()) _facade = None except Exception as e: raise exc.DBError("Failed to drop database: %s" % e)
def drop_db(): global _facade try: models.Workbook.metadata.drop_all(b.get_engine()) _facade = None except Exception as e: raise exc.DBException("Failed to drop database: %s" % e)
def _clean_db(self): contexts = [get_context(default=False), get_context(default=True)] for ctx in contexts: auth_context.set_ctx(ctx) with mock.patch('mistral.services.security.get_project_id', new=mock.MagicMock(return_value=ctx.project_id)): with db_api_v2.transaction(): db_api_v2.delete_executions() db_api_v2.delete_workbooks() db_api_v2.delete_cron_triggers() db_api_v2.delete_workflow_definitions() db_api_v2.delete_environments() sqlite_lock.cleanup() if not cfg.CONF.database.connection.startswith('sqlite'): db_sa_base.get_engine().dispose()
def drop_db(): global _initialized with _SCHEMA_LOCK: if not _initialized: return try: models.Workbook.metadata.drop_all(b.get_engine()) _initialized = False except Exception as e: raise exc.DBError("Failed to drop database: %s" % e)
def setup_db(): global _initialized with _SCHEMA_LOCK: if _initialized: return try: models.Workbook.metadata.create_all(b.get_engine()) _initialized = True except sa.exc.OperationalError as e: raise exc.DBError("Failed to setup database: %s" % e)
def setup_db(): try: models.Workbook.metadata.create_all(b.get_engine()) except sa.exc.OperationalError as e: raise exc.DBError("Failed to setup database: %s" % e)
def setup_db(): try: models.Workbook.metadata.create_all(b.get_engine()) except sa.exc.OperationalError as e: raise exc.DBException("Failed to setup database: %s" % e)