CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Public Attributes
edmIntegrityCheck.PublishToFileSystem Class Reference
Inheritance diagram for edmIntegrityCheck.PublishToFileSystem:

Public Member Functions

def __init__
 
def get
 
def publish
 
def read
 

Public Attributes

 parent
 

Detailed Description

Write a report to storage

Definition at line 17 of file edmIntegrityCheck.py.

Constructor & Destructor Documentation

def edmIntegrityCheck.PublishToFileSystem.__init__ (   self,
  parent 
)

Definition at line 20 of file edmIntegrityCheck.py.

20 
21  def __init__(self, parent):
22  if isinstance(parent, type("")):
23  self.parent = parent
24  else:
25  self.parent = parent.__class__.__name__

Member Function Documentation

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, dqm::implementation::IBooker::UseScope< SCOPE >.parent, readConfig.fileINI.read(), cond::FileReader.read(), SectorProcessorLUT.read(), PtLUTReader.read(), AlignmentCorrelationsIO.read(), PtAssignmentEngine.read(), FileBlob.read(), edm::RawInputSource.read(), AlignmentCorrelationsIORoot.read(), pos::PixelROCTrimBits.read(), pos::PixelROCMaskBits.read(), MultiFileBlob.read(), FileReaderDCC.read(), FileReaderDDU.read(), LMap::impl.read(), AlignmentUserVariablesIO.read(), trklet::CircularBuffer< T >.read(), AlignmentParametersIO.read(), pos::PixelROCDACSettings.read(), SurveyPxbImageReader< T >.read(), personalPlayback.Applet.read(), ProduceDropBoxMetadata.read, trklet::MatchEngineUnit.read(), bistream_iterator< T >.read(), trklet::TrackletEngineUnit.read(), PyBind11ProcessDesc.read(), RawFile.read(), l1t::LUT.read(), PedeReader.read(), FedRawDataInputSource.read(), edmIntegrityCheck.PublishToFileSystem.read(), NuclearInteractionSimulator.read(), MixingInputConfig.read(), edmplugin::CacheParser.read(), npstat::StorableMultivariateFunctor.read(), MillePedeFileReader.read(), BuildTrackerMapPlugin.read(), CSCPairResidualsConstraint.read(), LMap.read(), npstat::UniformAxis.read(), MixingModuleConfig.read(), fastsim::NuclearInteraction.read(), npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >.read(), npstat::DualAxis.read(), npstat::NUHistoAxis.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(), DTTFBitArray< N >.read(), BitArray< 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 
65  def get(self, dir):
66  """Finds the lastest file and reads it"""
67  reg = '^%s_.*\.txt$' % self.parent
68  files = castortools.matchingFiles(dir, reg)
69  files = sorted([ (os.path.basename(f), f) for f in files])
70  if not files:
71  return None
72  return self.read(files[-1][1])
73 
def edmIntegrityCheck.PublishToFileSystem.publish (   self,
  report 
)
Publish a file

Definition at line 26 of file edmIntegrityCheck.py.

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

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

Definition at line 55 of file edmIntegrityCheck.py.

References mergeVDriftHistosByStation.file.

Referenced by edmIntegrityCheck.PublishToFileSystem.get().

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

Member Data Documentation

edmIntegrityCheck.PublishToFileSystem.parent

Definition at line 22 of file edmIntegrityCheck.py.

Referenced by BeautifulSoup.PageElement._invert(), edmIntegrityCheck.PublishToFileSystem.get(), and edmIntegrityCheck.PublishToFileSystem.publish().