Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-09-25 01:44:55

0001 """
0002 
0003 Contains classes for shell part of framework - basically a collection of classes that are designed to be invoked on the command line.
0004 
0005 """
0006 
0007 from . import querying
0008 import sys
0009 
0010 connections = []
0011 
0012 # function to setup database connection, based on given database name
0013 def connect(connection_data=None, mode="r", map_blobs=False, secrets=None, pooling=True):
0014     if connection_data == None:
0015         connection_data = "frontier://FrontierProd/CMS_CONDITIONS"
0016     connection = querying.connect(connection_data, mode=mode, map_blobs=map_blobs, secrets=secrets, pooling=pooling)
0017     connections.append(connection)
0018     return connection
0019 
0020 def close_connections(verbose=True):
0021     global connections
0022     for connection in connections:
0023         connection_string = "%s/%s" % (connection.connection_data["database_name"], connection.connection_data["schema"])
0024         connection.tear_down()
0025         if verbose:
0026             print("Connection to %s was closed." % connection_string)