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 30 of file periodInfo.py.

Constructor & Destructor Documentation

◆ __init__()

def periodInfo.AMIWrapper.__init__ (   self)

Definition at line 31 of file periodInfo.py.

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

Member Function Documentation

◆ periods()

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

Definition at line 59 of file periodInfo.py.

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

◆ 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 46 of file periodInfo.py.

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

◆ 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 77 of file periodInfo.py.

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

◆ runsForPeriod()

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

Definition at line 69 of file periodInfo.py.

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

Member Data Documentation

◆ ami

periodInfo.AMIWrapper.ami

Definition at line 33 of file periodInfo.py.

◆ configFileName

periodInfo.AMIWrapper.configFileName

Definition at line 40 of file periodInfo.py.


The documentation for this class was generated from the following file:
run
int run(int argc, char *argv[])
Definition: ttree2hdf5.cxx:28
LArG4FSStartPointFilterLegacy.execute
execute
Definition: LArG4FSStartPointFilterLegacy.py:20
DerivationFramework::TriggerMatchingUtils::sorted
std::vector< typename T::value_type > sorted(T begin, T end)
Helper function to create a sorted vector from an unsorted one.
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