ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
periodInfo.AMIWrapper Class Reference
Collaboration diagram for periodInfo.AMIWrapper:

Public Member Functions

def __init__ (self)
 
def run (self, cmd)
 
def periods (self, period=None, level=None, project=None, status=None)
 
def runsForPeriod (self, period, project)
 
def runListsPerPeriod (self, location='/afs/cern.ch/user/a/atlidbs/nt/DataPeriods/')
 

Public Attributes

 ami
 
 configFileName
 

Detailed Description

Definition at line 29 of file periodInfo.py.

Constructor & Destructor Documentation

◆ __init__()

def periodInfo.AMIWrapper.__init__ (   self)

Definition at line 30 of file periodInfo.py.

30  def __init__(self):
31  "Initalise AMI"
32  self.ami=pyAMI.client.Client('atlas')
33  #if options.config:
34  # self.configFileName = os.path.expanduser(options.config)
35  #else:
36  #sys.exit('No authentication file specified')
37  #self.ami.readConfig(self.configFileName)
38  if options.config:
39  self.configFileName = os.path.expanduser(options.config)
40  else:
41  sys.exit('No authentication file specified')
42  print (self.configFileName)
43  #self.ami=pyAMI.client.Client('atlas',key_file=self.configFileName,ignore_proxy=True,verbose=True)
44 

Member Function Documentation

◆ periods()

def periodInfo.AMIWrapper.periods (   self,
  period = None,
  level = None,
  project = None,
  status = None 
)

Definition at line 58 of file periodInfo.py.

58  def periods(self, period=None, level=None, project=None, status=None):
59  "Get list of periods. By default return all periods"
60 
61  cmd = 'ListDataPeriods'
62  if period: cmd += ' period='+period
63  if level: cmd += ' periodLevel='+level
64  if project: cmd += ' projectName='+project
65  if status: cmd += ' status='+status
66  return self.run(cmd)
67 

◆ run()

def periodInfo.AMIWrapper.run (   self,
  cmd 
)
Execute an AMI command given as a list of command and paramters (ami format) or
space separated string (for convenience)

Definition at line 45 of file periodInfo.py.

45  def run(self, cmd):
46  """
47  Execute an AMI command given as a list of command and paramters (ami format) or
48  space separated string (for convenience)
49  """
50  if isinstance(cmd, str):
51  cmd = cmd.split()
52 
53  print ('PRINT AMI CMD', cmd )
54  results = self.ami.execute(cmd,format='dict_object')
55 
56  return results.get_rows()
57 

◆ runListsPerPeriod()

def periodInfo.AMIWrapper.runListsPerPeriod (   self,
  location = '/afs/cern.ch/user/a/atlidbs/nt/DataPeriods/' 
)
Generate files containing run lists for periods if they don't already exist

Definition at line 76 of file periodInfo.py.

76  def runListsPerPeriod(self, location='/afs/cern.ch/user/a/atlidbs/nt/DataPeriods/'):
77  """
78  Generate files containing run lists for periods if they don't already exist
79  """
80  # Don't only update unlocked periods since they may change as looked so need to check at least once more
81  # Need to find a better way fo doing this but for now update all
82  periods = self.periods() #status='unlocked')
83  path = os.path
84  num = 0
85 
86  for p in periods:
87  #print ('Looking at period: ', p )
88  projectDir =path.normpath(location + '/' + p['projectName'])
89 
90  if not path.exists(projectDir):
91  os.makedirs(projectDir)
92 
93  filename = '%s/%s.runs.list' % (projectDir,p['period'])
94 
95  #if path.exists(filename): continue
96 
97  # Need to remove the file as it might have changed from last time
98  if path.exists(filename):
99  os.system('rm ' + filename)
100 
101  print ('* Creating run list for %(projectName)s %(period)s ...' % p)
102 
103  num += 1
104  #if p['period'] == 'A1' and p['projectName'] == 'data15_1beam':
105  # continue
106  try:
107  runs = self.runsForPeriod(p['period'], p['projectName'])
108  except:
109  continue
110  runList = '\n'.join(sorted([r['runNumber'] for r in runs]))
111  runList += '\n' # Needed for cat to work!
112  print (runList)
113  with open(filename, 'w') as f:
114  f.write(runList)
115 
116  print (' ... written to', filename, '\n' )
117 
118  if not num:
119  print ('* No new period infomation to create')

◆ runsForPeriod()

def periodInfo.AMIWrapper.runsForPeriod (   self,
  period,
  project 
)

Definition at line 68 of file periodInfo.py.

68  def runsForPeriod(self, period, project):
69  "Get info on runs for a particular period"
70 
71  cmd = 'GetRunsForDataPeriod period='+period
72  cmd += ' projectName='+project
73  print (cmd)
74  return self.run(cmd)
75 

Member Data Documentation

◆ ami

periodInfo.AMIWrapper.ami

Definition at line 32 of file periodInfo.py.

◆ configFileName

periodInfo.AMIWrapper.configFileName

Definition at line 39 of file periodInfo.py.


The documentation for this class was generated from the following file:
DerivationFramework::TriggerMatchingUtils::sorted
std::vector< typename R::value_type > sorted(const R &r, PROJ proj={})
Helper function to create a sorted vector from an unsorted range.
run
int run(int argc, char *argv[])
Definition: ttree2hdf5.cxx:28
LArG4FSStartPointFilterLegacy.execute
execute
Definition: LArG4FSStartPointFilterLegacy.py:20
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
Trk::open
@ open
Definition: BinningType.h:40