CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
edmIntegrityCheck.PublishToFileSystem Class Reference
Inheritance diagram for edmIntegrityCheck.PublishToFileSystem:

Public Member Functions

def __init__ (self, parent)
 
def get (self, dir)
 
def publish (self, report)
 
def read (self, lfn, local=False)
 

Public Attributes

 parent
 

Detailed Description

Write a report to storage

Definition at line 17 of file edmIntegrityCheck.py.

Constructor & Destructor Documentation

◆ __init__()

def edmIntegrityCheck.PublishToFileSystem.__init__ (   self,
  parent 
)

Definition at line 20 of file edmIntegrityCheck.py.

20  def __init__(self, parent):
21  if isinstance(parent, type("")):
22  self.parent = parent
23  else:
24  self.parent = parent.__class__.__name__
25 
def __init__(self, dataset, job_number, job_id, job_name, isDA, isMC, applyBOWS, applyEXTRACOND, extraconditions, runboundary, lumilist, intlumi, maxevents, gt, allFromGT, alignmentDB, alignmentTAG, apeDB, apeTAG, bowDB, bowTAG, vertextype, tracktype, refittertype, ttrhtype, applyruncontrol, ptcut, CMSSW_dir, the_dir)

Member Function Documentation

◆ get()

def edmIntegrityCheck.PublishToFileSystem.get (   self,
  dir 
)
Finds the lastest file and reads it

Definition at line 64 of file edmIntegrityCheck.py.

References edmIntegrityCheck.PublishToFileSystem.parent, confdb.HLTProcess.parent, FWPSetTableManager::PSetData.parent, emtf::Node.parent, EmDQMReco::FourVectorMonitorElements.parent, SlimmedCount.parent, options.HLTProcessOptions.parent, BeautifulSoup.PageElement.parent, dqm::implementation::IBooker::UseScope< SCOPE >.parent, readConfig.fileINI.read(), SectorProcessorLUT.read(), cond::FileReader.read(), PtLUTReader.read(), AlignmentCorrelationsIO.read(), PtAssignmentEngine.read(), FileBlob.read(), edm::RawInputSource.read(), pos::PixelROCTrimBits.read(), AlignmentCorrelationsIORoot.read(), pos::PixelROCMaskBits.read(), MultiFileBlob.read(), FileReaderDCC.read(), FileReaderDDU.read(), LMap::impl.read(), AlignmentUserVariablesIO.read(), trklet::CircularBuffer< T >.read(), AlignmentParametersIO.read(), pos::PixelROCDACSettings.read(), personalPlayback.Applet.read(), SurveyPxbImageReader< T >.read(), ProduceDropBoxMetadata.read, trklet::MatchEngineUnit.read(), bistream_iterator< T >.read(), PyBind11ProcessDesc.read(), RawFile.read(), trklet::TrackletEngineUnit.read(), PedeReader.read(), l1t::LUT.read(), FedRawDataInputSource.read(), edmIntegrityCheck.PublishToFileSystem.read(), NuclearInteractionSimulator.read(), MixingInputConfig.read(), edmplugin::CacheParser.read(), npstat::StorableMultivariateFunctor.read(), BuildTrackerMapPlugin.read(), CSCPairResidualsConstraint.read(), LMap.read(), MillePedeFileReader.read(), npstat::UniformAxis.read(), MixingModuleConfig.read(), fastsim::NuclearInteraction.read(), npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >.read(), npstat::NUHistoAxis.read(), npstat::DualAxis.read(), edm::FileInPath.read(), MuonResidualsTwoBin.read(), edm::StreamerInputSource.read(), npstat::GridAxis.read(), npstat::HistoAxis.read(), npstat::DualHistoAxis.read(), npstat::StorableInterpolationFunctor< Numeric, Axis, Converter >.read(), DQMTTreeIO::TreeReaderBase.read(), MuonResidualsFitter.read(), DQMTTreeIO::TreeObjectReader< T >.read(), npstat::LinInterpolatedTableND< Numeric, Axis >.read(), DQMTTreeIO::TreeStringReader.read(), BitArray< N >.read(), DTTFBitArray< N >.read(), DQMTTreeIO::TreeSimpleReader< T >.read(), and npstat::HistoND< Numeric, Axis >.read().

Referenced by Options.Options.__getitem__(), betterConfigParser.BetterConfigParser.__updateDict(), submitPVValidationJobs.BetterConfigParser.__updateDict(), betterConfigParser.BetterConfigParser.getCompares(), betterConfigParser.BetterConfigParser.getGeneral(), betterConfigParser.BetterConfigParser.getResultingSection(), and submitPVValidationJobs.BetterConfigParser.getResultingSection().

64  def get(self, dir):
65  """Finds the lastest file and reads it"""
66  reg = '^%s_.*\.txt$' % self.parent
67  files = castortools.matchingFiles(dir, reg)
68  files = sorted([ (os.path.basename(f), f) for f in files])
69  if not files:
70  return None
71  return self.read(files[-1][1])
72 
73 

◆ publish()

def edmIntegrityCheck.PublishToFileSystem.publish (   self,
  report 
)
Publish a file

Definition at line 26 of file edmIntegrityCheck.py.

References geometryDiff.file, edmIntegrityCheck.PublishToFileSystem.parent, confdb.HLTProcess.parent, FWPSetTableManager::PSetData.parent, emtf::Node.parent, EmDQMReco::FourVectorMonitorElements.parent, SlimmedCount.parent, options.HLTProcessOptions.parent, BeautifulSoup.PageElement.parent, dqm::implementation::IBooker::UseScope< SCOPE >.parent, and print().

26  def publish(self, report):
27  """Publish a file"""
28  for path in report['PathList']:
29  _, name = tempfile.mkstemp('.txt', text=True)
30  json.dump(report, file(name,'w'), sort_keys=True, indent=4)
31 
32  fname = '%s_%s.txt' % (self.parent, report['DateCreated'])
33  #rename the file locally - TODO: This is a potential problem
34  nname = os.path.join(os.path.dirname(name),fname)
35  os.rename(name, nname)
36 
37  castor_path = castortools.lfnToCastor(path)
38  new_name = '%s/%s' % (castor_path, fname)
39  castortools.xrdcp(nname,path)
40  time.sleep(1)
41 
42  if castortools.fileExists(new_name):
43 
44  #castortools.move(old_name, new_name)
45  #castortools.chmod(new_name, '644')
46 
47  print("File published: '%s'" % castortools.castorToLFN(new_name))
48  os.remove(nname)
49  else:
50  pathhash = path.replace('/','.')
51  hashed_name = 'PublishToFileSystem-%s-%s' % (pathhash, fname)
52  shutil.move(nname, hashed_name)
53  print("Cannot write to directory '%s' - written to local file '%s' instead." % (castor_path, hashed_name), file=sys.stderr)
54 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

◆ read()

def edmIntegrityCheck.PublishToFileSystem.read (   self,
  lfn,
  local = False 
)
Reads a report from storage

Definition at line 55 of file edmIntegrityCheck.py.

References geometryDiff.file.

Referenced by edmIntegrityCheck.PublishToFileSystem.get().

55  def read(self, lfn, local = False):
56  """Reads a report from storage"""
57  if local:
58  cat = file(lfn).read()
59  else:
60  cat = castortools.cat(castortools.lfnToCastor(lfn))
61  #print "the cat is: ", cat
62  return json.loads(cat)
63 

Member Data Documentation

◆ parent

edmIntegrityCheck.PublishToFileSystem.parent