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 18 of file edmIntegrityCheck.py.

Constructor & Destructor Documentation

◆ __init__()

def edmIntegrityCheck.PublishToFileSystem.__init__ (   self,
  parent 
)

Definition at line 21 of file edmIntegrityCheck.py.

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

Member Function Documentation

◆ get()

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

Definition at line 65 of file edmIntegrityCheck.py.

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 
74 

References edmIntegrityCheck.PublishToFileSystem.parent, confdb.HLTProcess.parent, FWPSetTableManager::PSetData.parent, emtf::Node.parent, EmDQMReco::FourVectorMonitorElements.parent, options.HLTProcessOptions.parent, BeautifulSoup.PageElement.parent, globcontrol.parent, dqm::implementation::IBooker::UseScope< SCOPE >.parent, readConfig.fileINI.read(), cond::FileReader.read(), SectorProcessorLUT.read(), PtLUTReader.read(), FileBlob.read(), AlignmentCorrelationsIO.read(), PtAssignmentEngine.read(), pos::PixelROCTrimBits.read(), AlignmentCorrelationsIORoot.read(), edm::RawInputSource.read(), pos::PixelROCMaskBits.read(), MultiFileBlob.read(), SimBeamSpotObjects.read(), trklet::CircularBuffer< T >.read(), trklet::MatchEngineUnit.read(), LMap::impl.read(), AlignmentUserVariablesIO.read(), AlignmentParametersIO.read(), pos::PixelROCDACSettings.read(), SurveyPxbImageReader< T >.read(), personalPlayback.Applet.read(), bistream_iterator< T >.read(), PyBind11ProcessDesc.read(), RawFile.read(), PedeReader.read(), l1t::LUT.read(), cmspython3::PyBind11ProcessDesc.read(), FedRawDataInputSource.read(), edmIntegrityCheck.PublishToFileSystem.read(), NuclearInteractionSimulator.read(), edmplugin::CacheParser.read(), MixingInputConfig.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(), betterConfigParser.BetterConfigParser.getCompares(), betterConfigParser.BetterConfigParser.getGeneral(), and betterConfigParser.BetterConfigParser.getResultingSection().

◆ publish()

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

Definition at line 27 of file edmIntegrityCheck.py.

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

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

◆ read()

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

Definition at line 56 of file edmIntegrityCheck.py.

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

References FrontierConditions_GlobalTag_cff.file.

Referenced by edmIntegrityCheck.PublishToFileSystem.get().

Member Data Documentation

◆ parent

edmIntegrityCheck.PublishToFileSystem.parent
FrontierConditions_GlobalTag_cff.file
file
Definition: FrontierConditions_GlobalTag_cff.py:13
edm::print
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
readEcalDQMStatus.read
read
Definition: readEcalDQMStatus.py:38