ATLAS Offline Software
Loading...
Searching...
No Matches
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 Types

typedef HLT::TypeInformation::for_each_type_c< typenameEDMLIST::map, my_functor, my_result<>, my_arg< HLT::TypeInformation::get_cont, CONTAINER > >::type result

Public Member Functions

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

Public Attributes

 python

Protected Attributes

dict _dataDictionary = {}

Detailed Description

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

Definition at line 39 of file trfReports.py.

Member Typedef Documentation

◆ result

Definition at line 90 of file EDM_MasterSearch.h.

Constructor & Destructor Documentation

◆ __init__()

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__()

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()

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()

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()

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
nlohmann::json json

◆ python()

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()

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
void print(char *figname, TCanvas *c1)

◆ writeGPickleReport()

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()

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()

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()

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 = {}
protected

Definition at line 41 of file trfReports.py.

◆ python

python.trfReports.trfReport.python

Reimplemented in python.trfReports.trfJobReport.

Definition at line 59 of file trfReports.py.


The documentation for this class was generated from the following file: