ATLAS Offline Software
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
JobDetails.JobDetails Class Reference
Inheritance diagram for JobDetails.JobDetails:
Collaboration diagram for JobDetails.JobDetails:

Public Member Functions

def __init__ (self)
 
def content (self, **args)
 
def configure (self)
 
def pageName (self)
 
def addPage (self, name, page, **attrs)
 
def addLink (self, name, alias, **attrs)
 
def addToPageHeader (self, snippet)
 
def index (self, **args)
 
def configureLinks (self)
 
def override (self)
 
def header (self, **args)
 
def navigation (self, **args)
 
def footer (self, **args)
 

Public Attributes

 pageConfig
 
 globalConfig
 
 isConfigured
 

Static Public Attributes

 exposed
 

Detailed Description

Definition at line 53 of file JobDetails.py.

Constructor & Destructor Documentation

◆ __init__()

def JobDetails.JobDetails.__init__ (   self)

Definition at line 55 of file JobDetails.py.

55  def __init__(self):
56  BeamSpotWebPage.__init__(self)
57  self.pageConfig['pageTitle'] = 'ATLAS Beam Spot Job Details'
58  self.addToPageHeader(tableSorter)
59 

Member Function Documentation

◆ addLink()

def WebPage.WebPage.addLink (   self,
  name,
  alias,
**  attrs 
)
inherited
Add a new link to the page tree. Links share page objects with
   other pages through aliasing. This allows using different links
   with different queries to the same page as if they were separate
   pages. For links, highlighting of the current page is disabled
   (if enabled, all links leading to the same page would be
   highlighted).

Definition at line 309 of file WebPage.py.

309  def addLink(self, name, alias, **attrs):
310  """Add a new link to the page tree. Links share page objects with
311  other pages through aliasing. This allows using different links
312  with different queries to the same page as if they were separate
313  pages. For links, highlighting of the current page is disabled
314  (if enabled, all links leading to the same page would be
315  highlighted)."""
316  self.globalConfig.pageList.append(name)
317  self.globalConfig.pageAttributes[name] = dict(attrs)
318  self.globalConfig.pageAttributes[name]['alias'] = alias
319 

◆ addPage()

def WebPage.WebPage.addPage (   self,
  name,
  page,
**  attrs 
)
inherited
Add a new web page to the page tree. All pages added via addPage
   share the same GlobalConfiguration object.

Definition at line 300 of file WebPage.py.

300  def addPage(self, name, page, **attrs):
301  """Add a new web page to the page tree. All pages added via addPage
302  share the same GlobalConfiguration object."""
303  page.globalConfig = self.globalConfig
304  page.pageConfig['pageName'] = name
305  self.globalConfig.pageList.append(name)
306  self.globalConfig.pageAttributes[name] = dict(attrs)
307  setattr(self,name,page) # Link page into page tree (for CherryPy)
308 

◆ addToPageHeader()

def WebPage.WebPage.addToPageHeader (   self,
  snippet 
)
inherited
Add a snippet of code to the page header. Use this e.g. to include JavaScript libraries.

Definition at line 320 of file WebPage.py.

320  def addToPageHeader(self, snippet):
321  """Add a snippet of code to the page header. Use this e.g. to include JavaScript libraries."""
322  self.pageConfig['pageHeaderSnippets'] += snippet
323 

◆ configure()

def BeamSpotWebPage.BeamSpotWebPage.configure (   self)
inherited
Final configuration of web application after all data is initialized.

Reimplemented from WebPage.WebPage.

Definition at line 49 of file BeamSpotWebPage.py.

49  def configure(self):
50  self.pageConfig['cssName'] = self.globalConfig.baseUrl+'/css/beamspot.css'
51  if not self.pageConfig.get('pageTitle',''):
52  self.pageConfig['pageTitle'] = 'ATLAS Beam Spot Web Page'
53  self.pageConfig['header'] = header
54  self.pageConfig['footer'] = footer
55  WebPage.configure(self)
56 
57 

◆ configureLinks()

def WebPage.WebPage.configureLinks (   self)
inherited
Based on configuration data, for each web page create two link entries in pageConfig:
   The first entry has the form url_PAGENAME and contains the complete URL to link to
   a page. The second entry is named href_PAGENAME and contains style information and a
   href= prefix with proper quotation marks in addition to the URL. These link entries
   should be used to generate links in HTML pages with snippets like <a %(href_PAGENAME)s>
   or <a href="%(url_PAGENAME)>. The link entries can only be generated once all
   configuration data is available, ie configureLinks must be called from configure
   and not from __init__.

Definition at line 353 of file WebPage.py.

353  def configureLinks(self):
354  """Based on configuration data, for each web page create two link entries in pageConfig:
355  The first entry has the form url_PAGENAME and contains the complete URL to link to
356  a page. The second entry is named href_PAGENAME and contains style information and a
357  href= prefix with proper quotation marks in addition to the URL. These link entries
358  should be used to generate links in HTML pages with snippets like <a %(href_PAGENAME)s>
359  or <a href="%(url_PAGENAME)>. The link entries can only be generated once all
360  configuration data is available, ie configureLinks must be called from configure
361  and not from __init__."""
362  for p in self.globalConfig.pageList:
363  page = self.globalConfig.pageAttributes[p].get('alias',p)
364  query = self.globalConfig.pageAttributes[p].get('query','')
365  style = self.globalConfig.pageAttributes[p].get('style',None)
366  self.pageConfig['url_'+p] = '%s/%s/%s' % (self.globalConfig.baseUrl,page,query)
367  if p==self.pageName():
368  self.pageConfig['href_'+p] = 'href="%s/%s/%s" class="%s"' % (self.globalConfig.baseUrl,page,query,self.pageConfig['css_currentLink'])
369  else:
370  if style:
371  self.pageConfig['href_'+p] = 'href="%s/%s/%s" class="%s"' % (self.globalConfig.baseUrl,page,query,style)
372  else:
373  self.pageConfig['href_'+p] = 'href="%s/%s/%s"' % (self.globalConfig.baseUrl,page,query)
374 

◆ content()

def JobDetails.JobDetails.content (   self,
**  args 
)
Generate the page content. Default value comes from self.pageConfig['content'].

Reimplemented from WebPage.WebPage.

Definition at line 60 of file JobDetails.py.

60  def content(self,**args):
61  if not 'd' in args:
62  return error % ('CONFIGURATION ERROR: No data set name specified')
63  if not 't' in args:
64  return error % ('CONFIGURATION ERROR: No task name specified')
65  with TaskManager(self.globalConfig['taskDb']) as taskman:
66  t = taskman.getTaskDict(args['d'],args['t'])
67  if not t:
68  return error % ('ERROR: Task %s/%s not found' % (args['d'],args['t']))
69 
70  p = '<div class="text"><h3>Summary for task %s/%s (task id %s):</h3></div>\n' % (args['d'],args['t'],t['TASKID'])
71  p += '<table>\n'
72  p += tableRow % ('Dataset name',t['DSNAME'])
73  p += tableRow % ('Run number',blankIfNone(t['RUNNR']))
74  p += tableRow % ('Task name',t['TASKNAME'])
75  stat = t['STATUS']
76  p += tableRowStatus % ('Task status',getStatusClass(stat),getKey(TaskManager.StatusCodes,stat))
77  p += tableRow % ('On-disk status',getKey(TaskManager.OnDiskCodes,t['ONDISK']))
78  p += tableRow % ('Template',t['TEMPLATE'])
79  p += tableRow % ('Postprocessing steps',t['TASKPOSTPROCSTEPS'])
80  p += tableRow % ('ATLAS release',t['ATLREL'])
81  p += tableRow % ('# result files',t['NRESULTFILES'])
82  p += tableRow % ('Result files',fileListSnippet(t['RESULTFILES'],t['DSNAME'],t['TASKNAME'],self.globalConfig['jobDir']))
83  p += tableRow % ('Result links',t['RESULTLINKS'])
84  cooltags = t['COOLTAGS'] or ''
85  p += tableRow % ('COOL tags','<br>'.join(cooltags.split()))
86  p += tableRow % ('# jobs',t['NJOBS'])
87  p += tableRow % ('# jobs submitted',t['NJOBS_SUBMITTED'])
88  p += tableRow % ('# jobs running',t['NJOBS_RUNNING'])
89  p += tableRow % ('# jobs postprocessing',t['NJOBS_POSTPROC'])
90  p += tableRow % ('# jobs failed',t['NJOBS_FAILED'])
91  p += tableRow % ('# jobs completed',t['NJOBS_COMPLETED'])
92  p += tableRow % ('Comment',t['TASKCOMMENT'])
93  p += tableRow % ('Created','%s by %s on host %s' % (time.ctime(t['CREATED']),t['CREATED_USER'],t['CREATED_HOST']))
94  p += tableRow % ('Last update',time.ctime(t['UPDATED']))
95  p += '</table>\n'
96 
97  p += '<div class="text"><h3>Job details (may be more up-to-date than summary data above):</h3></div>\n'
98  p += tableHeader;
99  a = JobAnalyzer(self.globalConfig['jobDir'],t['DSNAME'],t['TASKNAME'])
100  for j in a.jobList():
101  p += "<tr>"
102  p += "<td>%s</td>" % (j)
103  (stat,exitcode) = a.jobStatus(j)
104  p += '<td class="%s">%s</td>' % (getStatusClass(stat),getKey(TaskManager.StatusCodes,stat))
105  p += "<td>%s</td>" % (exitcode)
106  p += '<td><a href="../files?u=%s/%s/%s">Files</a></td>' %(t['DSNAME'],t['TASKNAME'],j)
107  p += "</tr>\n"
108  p += "</tbody></table>\n"
109  return p
110 
111 
112 # Code to test or run locally

◆ footer()

def WebPage.WebPage.footer (   self,
**  args 
)
inherited
Generate the footer. Default value comes from self.pageConfig['footer'].

Definition at line 395 of file WebPage.py.

395  def footer(self, **args):
396  """Generate the footer. Default value comes from self.pageConfig['footer']."""
397  return self.pageConfig['footer'] % self.pageConfig
398 
399 
400 # Example configuration file on how to run CherryPy with Apache mod_python:
401 #
402 # <Location "/">
403 # PythonPath "sys.path+['/whatever']"
404 # SetHandler python-program
405 # PythonHandler cherrypy._cpmodpy::handler
406 # PythonOption cherrypy.setup WebPage::setup_server
407 # PythonDebug On
408 # </Location>
409 #
410 #import cherrypy
411 #def setup_server():
412 # cherrypy.config.update({'environment': 'production',
413 # 'log.screen': False,
414 # 'server.socket_host': '127.0.0.1',
415 # 'log.error_file': '/tmp/site.log',
416 # 'show_tracebacks': False})
417 # cherrypy.tree.mount(WebPage())
418 
419 
420 # Test code

◆ header()

def WebPage.WebPage.header (   self,
**  args 
)
inherited
Generate the page header. Default value comes from self.pageConfig['header'].

Definition at line 383 of file WebPage.py.

383  def header(self, **args):
384  """Generate the page header. Default value comes from self.pageConfig['header']."""
385  return self.pageConfig['header'] % self.pageConfig
386 

◆ index()

def WebPage.WebPage.index (   self,
**  args 
)
inherited
Return the complete page.

Definition at line 324 of file WebPage.py.

324  def index(self, **args):
325  """Return the complete page."""
326  if not self.isConfigured:
327  self.configure()
328  s = self.override()
329  if not s:
330  self.pageConfig['timeStamp'] = time.strftime('%a %b %d %X %Z %Y')
331  contents = self.content(**args) # Make sure contents is run first (so it
332  # can change any pageConfig entries if desired
333  s = startPage % self.pageConfig
334  s = s + htmlDiv('header', self.header(**args),
335  keepEmptyDiv=self.pageConfig['keepEmptyHeader'])
336  s = s + htmlDiv('navigation', self.navigation(**args),
337  keepEmptyDiv=self.pageConfig['keepEmptyNavigation'])
338  s = s + htmlDiv('content', contents,
339  keepEmptyDiv=self.pageConfig['keepEmptyContent'])
340  s = s + htmlDiv('footer', self.footer(**args),
341  keepEmptyDiv=self.pageConfig['keepEmptyFooter'])
342  s = s + endPage
343  return s

◆ navigation()

def WebPage.WebPage.navigation (   self,
**  args 
)
inherited
Generate the navigation bar. Default value comes from self.pageConfig['navigation'].

Definition at line 387 of file WebPage.py.

387  def navigation(self, **args):
388  """Generate the navigation bar. Default value comes from self.pageConfig['navigation']."""
389  return self.pageConfig['navigation'] % self.pageConfig
390 

◆ override()

def WebPage.WebPage.override (   self)
inherited
Override provides a hook where code to generate or redirect to an alternative
   page can be placed by derived classes. If not override of the normal page is
   desired, override should return None. Otherwise it should either raise an
   appropriate exception or return a string containing the complete alternate page
   to display.

Definition at line 375 of file WebPage.py.

375  def override(self):
376  """Override provides a hook where code to generate or redirect to an alternative
377  page can be placed by derived classes. If not override of the normal page is
378  desired, override should return None. Otherwise it should either raise an
379  appropriate exception or return a string containing the complete alternate page
380  to display."""
381  return None
382 

◆ pageName()

def WebPage.WebPage.pageName (   self)
inherited
Short cut to retrieve the name (the last element in the URL)
   of the current page. This works only if the page has been
   added into the page tree using addPage.

Definition at line 294 of file WebPage.py.

294  def pageName(self):
295  """Short cut to retrieve the name (the last element in the URL)
296  of the current page. This works only if the page has been
297  added into the page tree using addPage."""
298  return self.pageConfig['pageName']
299 

Member Data Documentation

◆ exposed

WebPage.WebPage.exposed
staticinherited

Definition at line 345 of file WebPage.py.

◆ globalConfig

WebPage.WebPage.globalConfig
inherited

Definition at line 290 of file WebPage.py.

◆ isConfigured

WebPage.WebPage.isConfigured
inherited

Definition at line 291 of file WebPage.py.

◆ pageConfig

WebPage.WebPage.pageConfig
inherited

Definition at line 273 of file WebPage.py.


The documentation for this class was generated from the following file:
configure
bool configure(asg::AnaToolHandle< ITrigGlobalEfficiencyCorrectionTool > &tool, ToolHandleArray< IAsgElectronEfficiencyCorrectionTool > &electronEffToolsHandles, ToolHandleArray< IAsgElectronEfficiencyCorrectionTool > &electronSFToolsHandles, ToolHandleArray< CP::IMuonTriggerScaleFactors > &muonToolsHandles, ToolHandleArray< IAsgPhotonEfficiencyCorrectionTool > &photonEffToolsHandles, ToolHandleArray< IAsgPhotonEfficiencyCorrectionTool > &photonSFToolsHandles, const std::string &triggers, const std::map< std::string, std::string > &legsPerTool, unsigned long nToys, bool debug)
Definition: TrigGlobEffCorrValidation.cxx:514
BeamSpotWebPage.footer
string footer
Definition: BeamSpotWebPage.py:32
grepfile.content
string content
Definition: grepfile.py:56
DeMoGenerateWWW.addLink
def addLink(l)
When https is found in a character line, add a link in html If none, simply return the line unchanged...
Definition: DeMoGenerateWWW.py:68
python.Utils.fileListSnippet
def fileListSnippet(files, dsName, taskName, jobDir=None)
Definition: InnerDetector/InDetExample/InDetBeamSpotExample/python/Utils.py:30
WebPage.htmlDiv
def htmlDiv(id, contents='', attr='', keepEmptyDiv=True)
Definition: WebPage.py:46
python.Utils.blankIfNone
def blankIfNone(s)
Definition: InnerDetector/InDetExample/InDetBeamSpotExample/python/Utils.py:41
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
DeMoScan.index
string index
Definition: DeMoScan.py:364
get
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition: hcg.cxx:127
python.TaskManager.getStatusClass
def getStatusClass(status)
Definition: TaskManager.py:53
pool::getKey
std::string getKey(const std::string &key, const std::string &encoded)
makeTOC.header
header
Definition: makeTOC.py:28