ATLAS Offline Software
Classes | Functions | Variables
python.TaskManager Namespace Reference

Classes

class  DbParam
 
class  JobAnalyzer
 
class  TaskAnalyzer
 
class  TaskManager
 
class  TaskManagerCheckError
 
class  TaskManagerDatabaseError
 

Functions

def dictFactory (cursor, row)
 
def getKey (d, v)
 
def getStatusClass (status)
 
def appendUnique (s, v)
 
def getFullTaskNames (taskman, dsname, taskname, requireSingleTask=False, confirmWithUser=False, addWildCards=True)
 
def getJobConfig (jobDir, dsName, taskName, jobName=' *')
 

Variables

string __author__ = 'Juerg Beringer'
 
string __version__ = 'TaskManager.py atlas/athena'
 

Function Documentation

◆ appendUnique()

def python.TaskManager.appendUnique (   s,
  v 
)

Definition at line 66 of file TaskManager.py.

66 def appendUnique(s,v):
67  if not s:
68  s = '' # make sure it is not None
69  if v not in s.split():
70  s = ' '.join([s,v])
71  return s
72 
73 

◆ dictFactory()

def python.TaskManager.dictFactory (   cursor,
  row 
)
Convert a tuple from a database query into a dictonary.

Definition at line 35 of file TaskManager.py.

35 def dictFactory(cursor, row):
36  """Convert a tuple from a database query into a dictonary."""
37  d = {}
38  for idx, col in enumerate(cursor.description):
39  d[col[0]] = row[idx]
40  return d
41 
42 

◆ getFullTaskNames()

def python.TaskManager.getFullTaskNames (   taskman,
  dsname,
  taskname,
  requireSingleTask = False,
  confirmWithUser = False,
  addWildCards = True 
)
Retrieve the full dataset and task names given a pair of (dsname,task) that may
   contain wildcards or be just a parital name such as the run number. Depending
   on the requireSingleTask and confirmWithUser settings a TaskManagerCheckError
   is raised if there are multiple tasks or if the user doesn't confirm.

Definition at line 74 of file TaskManager.py.

74 def getFullTaskNames(taskman,dsname,taskname,requireSingleTask=False,confirmWithUser=False,addWildCards=True):
75  """Retrieve the full dataset and task names given a pair of (dsname,task) that may
76  contain wildcards or be just a parital name such as the run number. Depending
77  on the requireSingleTask and confirmWithUser settings a TaskManagerCheckError
78  is raised if there are multiple tasks or if the user doesn't confirm."""
79  taskList = taskman.getTaskNames(dsname,taskname,addWildCards)
80  if len(taskList)==0:
81  raise TaskManagerCheckError ('ERROR: No tasks found for dataset = %s, task = %s' % (dsname,taskname))
82  if requireSingleTask and len(taskList)!=1:
83  m = "ERROR: Multiple data set names found for dataset = %s, task = %s\n Please use full dataset or task name from list below, using option -n if necessary:\n\n" % (dsname,taskname)
84  m += " %-50s %s\n" % ('DATASET NAME','TASK NAME')
85  m += " %s\n" % (75*'-')
86  for t in taskList:
87  m += " %-50s %s\n" % (t[0],t[1])
88  m += '\n'
89  raise TaskManagerCheckError (m)
90  if confirmWithUser:
91  print ('Please confirm that you want to execute this command for the following tasks:\n')
92  print (" %-50s %s" % ('DATASET NAME','TASK NAME'))
93  print (" %s" % (75*'-'))
94  for t in taskList:
95  print (" %-50s %s" % (t[0],t[1]))
96  a = input('\nARE YOU SURE [n] ? ')
97  if a!='y':
98  raise TaskManagerCheckError ('ERROR: Aborted by user')
99  print()
100  return taskList
101 
102 

◆ getJobConfig()

def python.TaskManager.getJobConfig (   jobDir,
  dsName,
  taskName,
  jobName = '*' 
)
Read config dict from job files.

Definition at line 103 of file TaskManager.py.

103 def getJobConfig(jobDir,dsName,taskName,jobName='*'):
104  """Read config dict from job files."""
105  config = {}
106  configFile = glob.glob('%s/%s/%s/%s/%s' % (jobDir,dsName,taskName,jobName,'*.config.py.final.py'))
107  if not configFile:
108  configFile = glob.glob('%s/%s/%s/%s/%s' % (jobDir,dsName,taskName,jobName,'*.config.py'))
109  if configFile:
110  exec(open(configFile[0]).read(),config) # Eval config file and put defs into config dict
111  return config['jobConfig']
112 
113 

◆ getKey()

def python.TaskManager.getKey (   d,
  v 
)
Get the key for which dictonary d has an entry with value v.
Returns 'Undefined' if there's no such key, if several values are found.

Definition at line 43 of file TaskManager.py.

43 def getKey(d, v):
44  """Get the key for which dictonary d has an entry with value v.
45  Returns 'Undefined' if there's no such key, if several values are found."""
46  l = [k for k in d.keys() if d[k]==v]
47  if len(l)==1:
48  return l[0]
49  else:
50  return 'Undefined'
51 
52 

◆ getStatusClass()

def python.TaskManager.getStatusClass (   status)
Returns 'ok', 'warn' or 'bad' depending on the value of status.

Definition at line 53 of file TaskManager.py.

53 def getStatusClass(status):
54  """Returns 'ok', 'warn' or 'bad' depending on the value of status."""
55  statusMap = {
56  7: 'bad',
57  10: 'ok',
58  11: 'bad'
59  }
60  if status in statusMap:
61  return statusMap[status]
62  else:
63  return 'warn'
64 
65 

Variable Documentation

◆ __author__

string python.TaskManager.__author__ = 'Juerg Beringer'
private

Definition at line 17 of file TaskManager.py.

◆ __version__

string python.TaskManager.__version__ = 'TaskManager.py atlas/athena'
private

Definition at line 18 of file TaskManager.py.

read
IovVectorMap_t read(const Folder &theFolder, const SelectionCriterion &choice, const unsigned int limit=10)
Definition: openCoraCool.cxx:569
python.TaskManager.getJobConfig
def getJobConfig(jobDir, dsName, taskName, jobName=' *')
Definition: TaskManager.py:103
python.TaskManager.appendUnique
def appendUnique(s, v)
Definition: TaskManager.py:66
LArG4FSStartPointFilter.exec
exec
Definition: LArG4FSStartPointFilter.py:103
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
python.TaskManager.getFullTaskNames
def getFullTaskNames(taskman, dsname, taskname, requireSingleTask=False, confirmWithUser=False, addWildCards=True)
Definition: TaskManager.py:74
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
python.TaskManager.getKey
def getKey(d, v)
Definition: TaskManager.py:43
Trk::open
@ open
Definition: BinningType.h:40
Muon::print
std::string print(const MuPatSegment &)
Definition: MuonTrackSteering.cxx:28
python.TaskManager.getStatusClass
def getStatusClass(status)
Definition: TaskManager.py:53
python.TaskManager.dictFactory
def dictFactory(cursor, row)
Definition: TaskManager.py:35