ATLAS Offline Software
Functions | Variables
taskman Namespace Reference

Functions

def getTaskManager (dbconn=None)
 

Variables

string __author__ = 'Juerg Beringer'
 
string __version__ = 'taskman.py atlas/athena'
 
string __usage__
 
 parser = OptionParser(usage=__usage__, version=__version__)
 
 dest
 
 action
 
 default
 
 False
 
 help
 
 None
 
 options
 
 args
 
 cmd = args[0]
 
 cmdargs = args[1:]
 
 proddir = options.proddir
 
 dbtype
 
 dbname
 
 a = raw_input('\nRECREATING TASK DATABASE SCHEMA - ANY EXISTING DATA WILL BE ERASED!\n\nARE YOU REALLY ABSOLUTELY SURE [n] ? ')
 
 dbconn
 
 createDatabase
 
 dbfile
 
 status = TaskManager.StatusCodes.get(statusName)
 
 output
 
int nDuplicates = 0
 
 qual = []
 
 dsname = cmdargs[0]
 
 taskname = cmdargs[1]
 
 taskList
 
 taskEntry = taskman.getTaskDict(t[0], t[1])
 
 taskpath = os.path.join(proddir, dsname, taskname)
 
list dirs = []
 
 dsName
 
 taskName
 
 nDefined
 
 configFile = glob.glob(os.path.join(proddir, dsName, taskName, '*', '*.config.py'))
 
 mtime = os.stat(configFile[0])[stat.ST_MTIME]
 
dictionary config = {}
 
dictionary template = config['jobConfig']['joboptionpath']
 
dictionary release = config['jobConfig']['release']
 
dictionary taskpostprocsteps = config['jobConfig']['taskpostprocsteps']
 
dictionary comment = config['jobConfig']['comment'] + ' (rebuilt from config file)'
 
 createdTime
 
 createdUser
 
 createdHost
 
 fromDbconn = cmdargs[0]
 
 wildcards = string.maketrans('*?', '%_')
 
 destDbtype
 
 destDbname
 
 fromDbtype
 
 fromDbname
 
int nImported = 0
 
string links = ''
 
 files = t.get('RESULTFILES','')
 
 summaryFiles = glob.glob('%s/%s/*beamspot.gif' % (dsname,taskname))
 
 f = r.split('/')[-1]
 
string pdf = f[:-3]+'pdf'
 
 monitoringFiles = glob.glob('%s/%s/*beamspotmon.gif' % (dsname,taskname))
 
string fieldNameString = ''
 
list params = []
 
 newFieldName = fieldName
 
list q = [ 'insert into TASKS (%s) values (' % fieldNameString ]
 
 statusName = cmdargs[2].upper()
 
int n = 0
 
 fieldName = cmdargs[2].upper()
 
 fieldValue = cmdargs[3]
 
 requireSingleTask
 
 confirmWithUser
 
 addWildCards
 
 batch
 
 True
 
string dir = '/'.join([proddir,dsname,task])
 
 earliestUpdateTime = time.time()-float(args[1])
 
 dsWidth = len(max([t['DSNAME'] for t in taskList],key=len))
 
 taskWidth = len(max([t['TASKNAME'] for t in taskList],key=len))
 
 statusWidth = len(max([t['STATUS'] for t in taskList],key=len))
 
string bodyFormat = '%%(DSNAME)%ss %%(TASKNAME)%ss %%(STATUS)%ss' %(dsWidth, taskWidth, statusWidth)
 
string mailBody = 'The following %s tasks have reported failures' % len(taskList)
 
 hours = round(float(args[1])/3600.)
 
int stat = os.system('source /afs/cern.ch/user/a/atlidbs/cron/mailwrapper; mailwrapper "[atlidbs] %s tasks report failures" "%s"' %(len(taskList), mailBody)) >> 8
 
def taskman = getTaskManager()
 
 debug
 

Function Documentation

◆ getTaskManager()

def taskman.getTaskManager (   dbconn = None)
Open task manager 

Definition at line 67 of file taskman.py.

67 def getTaskManager(dbconn=None):
68  ''' Open task manager '''
69  dbconn = dbconn or options.dbconn
70  try:
71  return TaskManager(dbconn)
72  except:
73  print ('ERROR: Unable to access task manager database %s' % dbconn)
74  sys.exit(1)
75 
76 #
77 # Initialize a new task database
78 #

Variable Documentation

◆ __author__

string taskman.__author__ = 'Juerg Beringer'
private

Definition at line 10 of file taskman.py.

◆ __usage__

string taskman.__usage__
private
Initial value:
1 = '''%prog [options] taskdbconn command [args ...]
2 
3 Commands are:
4 
5 init Create a new database
6 checkdb Check (and fix) sqlite database
7 checkdup Check task database for duplicate entries
8 debug Interactive debugging (EXPERTS ONLY!)
9 dump [DSNAME TASKNAME] Dump all or selected tasks in database
10 show DSNAME [TASKNAME] Show list of tasks
11 update Update information of ongoing tasks
12 update DSNAME TASKNAME Update information of selected tasks
13 rebuild [DSNAME TASKNAME] Rebuild missing or selected database entries from job files
14 import [DSNAME TASKNAME] DBCONN Import all or selected tasks from database DBCONN (duplicates not checked)
15 setstatus DSNAME TASKNAME STATUS Set status of selected tasks to STATUS
16 setfield DSNAME TASKNAME FIELDNAME VALUE Set database field to value (experts only!)
17 delete DSNAME TASKNAME Delete entry for selected task(s) (task files are NOT removed)
18 deleteResults DSNAME TASKNAME Delete postprocessing results for selected set of tasks
19 deleteTask DSNAME TASKNAME Delete task files and corresponding TaskManager entry
20  for a single task (will prompt for confirmation unless
21  option --batch is used)
22 '''

Definition at line 12 of file taskman.py.

◆ __version__

string taskman.__version__ = 'taskman.py atlas/athena'
private

Definition at line 11 of file taskman.py.

◆ a

taskman.a = raw_input('\nRECREATING TASK DATABASE SCHEMA - ANY EXISTING DATA WILL BE ERASED!\n\nARE YOU REALLY ABSOLUTELY SURE [n] ? ')

Definition at line 97 of file taskman.py.

◆ action

taskman.action

Definition at line 48 of file taskman.py.

◆ addWildCards

taskman.addWildCards

Definition at line 502 of file taskman.py.

◆ args

taskman.args

Definition at line 56 of file taskman.py.

◆ batch

taskman.batch

Definition at line 566 of file taskman.py.

◆ bodyFormat

string taskman.bodyFormat = '%%(DSNAME)%ss %%(TASKNAME)%ss %%(STATUS)%ss' %(dsWidth, taskWidth, statusWidth)

Definition at line 646 of file taskman.py.

◆ cmd

taskman.cmd = args[0]

Definition at line 60 of file taskman.py.

◆ cmdargs

taskman.cmdargs = args[1:]

Definition at line 61 of file taskman.py.

◆ comment

string taskman.comment = config['jobConfig']['comment'] + ' (rebuilt from config file)'

Definition at line 329 of file taskman.py.

◆ config

dictionary taskman.config = {}

Definition at line 314 of file taskman.py.

◆ configFile

taskman.configFile = glob.glob(os.path.join(proddir, dsName, taskName, '*', '*.config.py'))

Definition at line 311 of file taskman.py.

◆ confirmWithUser

taskman.confirmWithUser

Definition at line 501 of file taskman.py.

◆ createDatabase

taskman.createDatabase

Definition at line 100 of file taskman.py.

◆ createdHost

taskman.createdHost

Definition at line 335 of file taskman.py.

◆ createdTime

taskman.createdTime

Definition at line 333 of file taskman.py.

◆ createdUser

taskman.createdUser

Definition at line 334 of file taskman.py.

◆ dbconn

taskman.dbconn

Definition at line 100 of file taskman.py.

◆ dbfile

taskman.dbfile

Definition at line 110 of file taskman.py.

◆ dbname

taskman.dbname

Definition at line 82 of file taskman.py.

◆ dbtype

taskman.dbtype

Definition at line 82 of file taskman.py.

◆ debug

taskman.debug

Definition at line 669 of file taskman.py.

◆ default

taskman.default

Definition at line 48 of file taskman.py.

◆ dest

taskman.dest

Definition at line 48 of file taskman.py.

◆ destDbname

taskman.destDbname

Definition at line 380 of file taskman.py.

◆ destDbtype

taskman.destDbtype

Definition at line 380 of file taskman.py.

◆ dir

string taskman.dir = '/'.join([proddir,dsname,task])

Definition at line 570 of file taskman.py.

◆ dirs

list taskman.dirs = []

Definition at line 284 of file taskman.py.

◆ dsname

taskman.dsname = cmdargs[0]

Definition at line 186 of file taskman.py.

◆ dsName

taskman.dsName

Definition at line 292 of file taskman.py.

◆ dsWidth

taskman.dsWidth = len(max([t['DSNAME'] for t in taskList],key=len))

Definition at line 642 of file taskman.py.

◆ earliestUpdateTime

int taskman.earliestUpdateTime = time.time()-float(args[1])

Definition at line 625 of file taskman.py.

◆ f

taskman.f = r.split('/')[-1]

Definition at line 409 of file taskman.py.

◆ False

taskman.False

Definition at line 48 of file taskman.py.

◆ fieldName

taskman.fieldName = cmdargs[2].upper()

Definition at line 492 of file taskman.py.

◆ fieldNameString

string taskman.fieldNameString = ''

Definition at line 431 of file taskman.py.

◆ fieldValue

taskman.fieldValue = cmdargs[3]

Definition at line 493 of file taskman.py.

◆ files

string taskman.files = t.get('RESULTFILES','')

Definition at line 401 of file taskman.py.

◆ fromDbconn

taskman.fromDbconn = cmdargs[0]

Definition at line 357 of file taskman.py.

◆ fromDbname

taskman.fromDbname

Definition at line 381 of file taskman.py.

◆ fromDbtype

taskman.fromDbtype

Definition at line 381 of file taskman.py.

◆ help

taskman.help

Definition at line 48 of file taskman.py.

◆ hours

taskman.hours = round(float(args[1])/3600.)

Definition at line 650 of file taskman.py.

◆ links

string taskman.links = ''

Definition at line 400 of file taskman.py.

◆ mailBody

string taskman.mailBody = 'The following %s tasks have reported failures' % len(taskList)

Definition at line 648 of file taskman.py.

◆ monitoringFiles

taskman.monitoringFiles = glob.glob('%s/%s/*beamspotmon.gif' % (dsname,taskname))

Definition at line 417 of file taskman.py.

◆ mtime

taskman.mtime = os.stat(configFile[0])[stat.ST_MTIME]

Definition at line 313 of file taskman.py.

◆ n

int taskman.n = 0

Definition at line 478 of file taskman.py.

◆ nDefined

taskman.nDefined
Initial value:
1 = taskman.getNTasks([
2  'where DSNAME=', DbParam(dsName),
3  'and TASKNAME=', DbParam(taskName)])

Definition at line 293 of file taskman.py.

◆ nDuplicates

int taskman.nDuplicates = 0

Definition at line 152 of file taskman.py.

◆ newFieldName

string taskman.newFieldName = fieldName

Definition at line 434 of file taskman.py.

◆ nImported

int taskman.nImported = 0

Definition at line 391 of file taskman.py.

◆ None

taskman.None

Definition at line 53 of file taskman.py.

◆ options

taskman.options

Definition at line 56 of file taskman.py.

◆ output

taskman.output

Definition at line 118 of file taskman.py.

◆ params

list taskman.params = []

Definition at line 432 of file taskman.py.

◆ parser

taskman.parser = OptionParser(usage=__usage__, version=__version__)

Definition at line 46 of file taskman.py.

◆ pdf

string taskman.pdf = f[:-3]+'pdf'

Definition at line 410 of file taskman.py.

◆ proddir

taskman.proddir = options.proddir

Definition at line 63 of file taskman.py.

◆ q

list taskman.q = [ 'insert into TASKS (%s) values (' % fieldNameString ]

Definition at line 444 of file taskman.py.

◆ qual

list taskman.qual = []

Definition at line 158 of file taskman.py.

◆ release

string taskman.release = config['jobConfig']['release']

Definition at line 321 of file taskman.py.

◆ requireSingleTask

taskman.requireSingleTask

Definition at line 500 of file taskman.py.

◆ stat

int taskman.stat = os.system('source /afs/cern.ch/user/a/atlidbs/cron/mailwrapper; mailwrapper "[atlidbs] %s tasks report failures" "%s"' %(len(taskList), mailBody)) >> 8

Definition at line 654 of file taskman.py.

◆ status

Definition at line 118 of file taskman.py.

◆ statusName

taskman.statusName = cmdargs[2].upper()

Definition at line 461 of file taskman.py.

◆ statusWidth

taskman.statusWidth = len(max([t['STATUS'] for t in taskList],key=len))

Definition at line 644 of file taskman.py.

◆ summaryFiles

taskman.summaryFiles = glob.glob('%s/%s/*beamspot.gif' % (dsname,taskname))

Definition at line 406 of file taskman.py.

◆ taskEntry

taskman.taskEntry = taskman.getTaskDict(t[0], t[1])

Definition at line 196 of file taskman.py.

◆ taskList

list taskman.taskList
Initial value:
1 = getFullTaskNames(taskman, dsname, taskname,
2  addWildCards=not options.nowildcards)

Definition at line 191 of file taskman.py.

◆ taskman

def taskman.taskman = getTaskManager()

Definition at line 668 of file taskman.py.

◆ taskname

string taskman.taskname = cmdargs[1]

Definition at line 187 of file taskman.py.

◆ taskName

taskman.taskName

Definition at line 292 of file taskman.py.

◆ taskpath

taskman.taskpath = os.path.join(proddir, dsname, taskname)

Definition at line 274 of file taskman.py.

◆ taskpostprocsteps

string taskman.taskpostprocsteps = config['jobConfig']['taskpostprocsteps']

Definition at line 325 of file taskman.py.

◆ taskWidth

taskman.taskWidth = len(max([t['TASKNAME'] for t in taskList],key=len))

Definition at line 643 of file taskman.py.

◆ template

string taskman.template = config['jobConfig']['joboptionpath']

Definition at line 317 of file taskman.py.

◆ True

taskman.True

Definition at line 566 of file taskman.py.

◆ wildcards

taskman.wildcards = string.maketrans('*?', '%_')

Definition at line 366 of file taskman.py.

python.TaskManager.getFullTaskNames
def getFullTaskNames(taskman, dsname, taskname, requireSingleTask=False, confirmWithUser=False, addWildCards=True)
Definition: TaskManager.py:74
taskman.getTaskManager
def getTaskManager(dbconn=None)
Definition: taskman.py:67