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 from __future__ import print_function
7 
8 import querying
9 import sys
10 
11 connections = []
12 
13 # function to setup database connection, based on given database name
14 def connect(connection_data=None, mode="r", map_blobs=False, secrets=None, pooling=True):
15  if connection_data == None:
16  connection_data = "frontier://FrontierProd/CMS_CONDITIONS"
17  connection = querying.connect(connection_data, mode=mode, map_blobs=map_blobs, secrets=secrets, pooling=pooling)
18  connections.append(connection)
19  return connection
20 
21 def close_connections(verbose=True):
22  global connections
23  for connection in connections:
24  connection_string = "%s/%s" % (connection.connection_data["database_name"], connection.connection_data["schema"])
25  connection.tear_down()
26  if verbose:
27  print("Connection to %s was closed." % connection_string)
def connect(connection_data, mode="r", map_blobs=False, secrets=None, pooling=True)
Definition: querying.py:451
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
def close_connections(verbose=True)
Definition: shell.py:21
def connect(connection_data=None, mode="r", map_blobs=False, secrets=None, pooling=True)
Definition: shell.py:14