CMS 3D CMS Logo

shell.py
Go to the documentation of this file.
1 """
2 
3 Contains classes for shell part of framework - basically a collection of classes that are designed to be invoked on the command line.
4 
5 """
6 
7 from . import querying
8 import sys
9 
10 connections = []
11 
12 # function to setup database connection, based on given database name
13 def connect(connection_data=None, mode="r", map_blobs=False, secrets=None, pooling=True):
14  if connection_data == None:
15  connection_data = "frontier://FrontierProd/CMS_CONDITIONS"
16  connection = querying.connect(connection_data, mode=mode, map_blobs=map_blobs, secrets=secrets, pooling=pooling)
17  connections.append(connection)
18  return connection
19 
20 def close_connections(verbose=True):
21  global connections
22  for connection in connections:
23  connection_string = "%s/%s" % (connection.connection_data["database_name"], connection.connection_data["schema"])
24  connection.tear_down()
25  if verbose:
26  print("Connection to %s was closed." % connection_string)
def connect(connection_data, mode="r", map_blobs=False, secrets=None, pooling=True)
Definition: querying.py:453
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
def close_connections(verbose=True)
Definition: shell.py:20
def connect(connection_data=None, mode="r", map_blobs=False, secrets=None, pooling=True)
Definition: shell.py:13