ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
python.trfReports.trfReport Class Reference

Base (almost virtual) report from which all real transform reports derive. More...

Inheritance diagram for python.trfReports.trfReport:
Collaboration diagram for python.trfReports.trfReport:

Public Member Functions

def __init__ (self)
 
def __str__ (self)
 String representation of the job report. More...
 
def python (self, fast=False, fileReport=defaultFileReport)
 Method which returns a python representation of a report. More...
 
def json (self, fast=False)
 Method which returns a JSON representation of a report. More...
 
def classicEltree (self, fast=False)
 Method which returns an ElementTree.Element representation of the old POOLFILECATALOG report. More...
 
def classicPython (self, fast=False)
 Method which returns a python representation of a report in classic Tier 0 style. More...
 
def writeJSONReport (self, filename, sort_keys=True, indent=2, fast=False, fileReport=defaultFileReport)
 
def writeTxtReport (self, filename, dumpEnv=True, fast=False, fileReport=defaultFileReport)
 
def writeGPickleReport (self, filename, fast=False)
 
def writeClassicXMLReport (self, filename, fast=False)
 
def writePilotPickleReport (self, filename, fast=False, fileReport=defaultFileReport)
 

Private Attributes

 _dataDictionary
 

Detailed Description

Base (almost virtual) report from which all real transform reports derive.

Definition at line 39 of file trfReports.py.

Constructor & Destructor Documentation

◆ __init__()

def python.trfReports.trfReport.__init__ (   self)

Definition at line 40 of file trfReports.py.

40  def __init__(self):
41  self._dataDictionary = {}
42  pass
43 

Member Function Documentation

◆ __str__()

def python.trfReports.trfReport.__str__ (   self)

String representation of the job report.

Uses pprint module to output the python object as text

Note
This is a 'property', so no fast option is available

Definition at line 47 of file trfReports.py.

47  def __str__(self):
48  return pprint.pformat(self.python())
49 

◆ classicEltree()

def python.trfReports.trfReport.classicEltree (   self,
  fast = False 
)

Method which returns an ElementTree.Element representation of the old POOLFILECATALOG report.

Parameters
fastBoolean which forces the fastest possible report to be written

Reimplemented in python.trfReports.trfJobReport.

Definition at line 63 of file trfReports.py.

63  def classicEltree(self, fast = False):
64  return ElementTree.Element('POOLFILECATALOG')
65 

◆ classicPython()

def python.trfReports.trfReport.classicPython (   self,
  fast = False 
)

Method which returns a python representation of a report in classic Tier 0 style.

Parameters
fastBoolean which forces the fastest possible report to be written

Reimplemented in python.trfReports.trfJobReport.

Definition at line 68 of file trfReports.py.

68  def classicPython(self, fast = False):
69  return {}
70 

◆ json()

def python.trfReports.trfReport.json (   self,
  fast = False 
)

Method which returns a JSON representation of a report.

Parameters
fastBoolean which forces the fastest possible report to be written

Calls json.dumps on the python representation

Definition at line 58 of file trfReports.py.

58  def json(self, fast = False):
59  return json.dumps(self.python, type)
60 

◆ python()

def python.trfReports.trfReport.python (   self,
  fast = False,
  fileReport = defaultFileReport 
)

Method which returns a python representation of a report.

Parameters
fastBoolean which forces the fastest possible report to be written

Reimplemented in python.trfReports.trfJobReport.

Definition at line 52 of file trfReports.py.

52  def python(self, fast = False, fileReport = defaultFileReport):
53  return {}
54 

◆ writeClassicXMLReport()

def python.trfReports.trfReport.writeClassicXMLReport (   self,
  filename,
  fast = False 
)

Definition at line 104 of file trfReports.py.

104  def writeClassicXMLReport(self, filename, fast = False):
105  with open(filename, 'w') as report:
106  print(prettyXML(self.classicEltree(fast = fast), poolFileCatalogFormat = True), file=report)
107 

◆ writeGPickleReport()

def python.trfReports.trfReport.writeGPickleReport (   self,
  filename,
  fast = False 
)

Definition at line 100 of file trfReports.py.

100  def writeGPickleReport(self, filename, fast = False):
101  with open(filename, 'wb') as report:
102  pickle.dump(self.classicPython(fast = fast), report)
103 

◆ writeJSONReport()

def python.trfReports.trfReport.writeJSONReport (   self,
  filename,
  sort_keys = True,
  indent = 2,
  fast = False,
  fileReport = defaultFileReport 
)

Definition at line 71 of file trfReports.py.

71  def writeJSONReport(self, filename, sort_keys = True, indent = 2, fast = False, fileReport = defaultFileReport):
72  with open(filename, 'w') as report:
73  try:
74  if not self._dataDictionary:
75  self._dataDictionary = self.python(fast=fast, fileReport=fileReport)
76 
77  json.dump(self._dataDictionary, report, sort_keys = sort_keys, indent = indent)
78  except TypeError as e:
79  # TypeError means we had an unserialisable object - re-raise as a trf internal
80  message = 'TypeError raised during JSON report output: {0!s}'.format(e)
81  msg.error(message)
82  raise trfExceptions.TransformReportException(trfExit.nameToCode('TRF_INTERNAL_REPORT_ERROR'), message)
83 

◆ writePilotPickleReport()

def python.trfReports.trfReport.writePilotPickleReport (   self,
  filename,
  fast = False,
  fileReport = defaultFileReport 
)

Definition at line 108 of file trfReports.py.

108  def writePilotPickleReport(self, filename, fast = False, fileReport = defaultFileReport):
109  with open(filename, 'w') as report:
110  if not self._dataDictionary:
111  self._dataDictionary = self.python(fast = fast, fileReport = fileReport)
112 
113  pickle.dump(self._dataDictionary, report)
114 
115 

◆ writeTxtReport()

def python.trfReports.trfReport.writeTxtReport (   self,
  filename,
  dumpEnv = True,
  fast = False,
  fileReport = defaultFileReport 
)

Definition at line 84 of file trfReports.py.

84  def writeTxtReport(self, filename, dumpEnv = True, fast = False, fileReport = defaultFileReport):
85  with open(filename, 'w') as report:
86  if not self._dataDictionary:
87  self._dataDictionary = self.python(fast = fast, fileReport = fileReport)
88 
89  print('# {0} file generated on'.format(self.__class__.__name__), isodate(), file=report)
90  print(pprint.pformat(self._dataDictionary), file=report)
91  if dumpEnv:
92  print('# Environment dump', file=report)
93  eKeys = list(os.environ)
94  eKeys.sort()
95  for k in eKeys:
96  print('%s=%s' % (k, os.environ[k]), file=report)
97  print('# Machine report', file=report)
98  print(pprint.pformat(machineReport().python(fast = fast)), file=report)
99 

Member Data Documentation

◆ _dataDictionary

python.trfReports.trfReport._dataDictionary
private

Definition at line 41 of file trfReports.py.


The documentation for this class was generated from the following file:
vtune_athena.format
format
Definition: vtune_athena.py:14
json
nlohmann::json json
Definition: HistogramDef.cxx:9
python.trfUtils.prettyXML
def prettyXML(element, indent=' ', poolFileCatalogFormat=False)
XML pretty print an ElementTree.ELement object.
Definition: trfUtils.py:397
python.trfUtils.isodate
def isodate()
Return isoformated 'now' string.
Definition: trfUtils.py:434
python
Definition: AtlasTest/TestTools/python/__init__.py:1
python.MadGraphUtils.python
string python
Definition: MadGraphUtils.py:14
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
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
dbg::print
void print(std::FILE *stream, std::format_string< Args... > fmt, Args &&... args)
Definition: SGImplSvc.cxx:70