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

Constructor & Destructor Documentation

def edmIntegrityCheck.PublishToFileSystem.__init__ (   self,
  parent 
)

Definition at line 19 of file edmIntegrityCheck.py.

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

Member Function Documentation

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

Definition at line 63 of file edmIntegrityCheck.py.

References edmIntegrityCheck.PublishToFileSystem.parent, confdb.HLTProcess.parent, EmDQMReco::FourVectorMonitorElements.parent, FWPSetTableManager::PSetData.parent, emtf::Node.parent, options.HLTProcessOptions.parent, BeautifulSoup.PageElement.parent, globcontrol.parent, readConfig.fileINI.read(), SectorProcessorLUT.read(), cond::FileReader.read(), PtLUTReader.read(), FileBlob.read(), PtAssignmentEngine.read(), AlignmentCorrelationsIO.read(), edm::RawInputSource.read(), MillePedeFileReader.read(), AlignmentCorrelationsIORoot.read(), SimBeamSpotObjects.read(), MultiFileBlob.read(), pos::PixelROCMaskBits.read(), pos::PixelROCTrimBits.read(), LMap::impl.read(), AlignmentUserVariablesIO.read(), personalPlayback.Applet.read(), pos::PixelROCDACSettings.read(), AlignmentParametersIO.read(), SurveyPxbImageReader< T >.read(), PythonProcessDesc.read(), bistream_iterator< T >.read(), l1t::LUT.read(), RawFile.read(), MixingInputConfig.read(), FedRawDataInputSource.read(), PedeReader.read(), edmIntegrityCheck.PublishToFileSystem.read(), CSCPairResidualsConstraint.read(), NuclearInteractionSimulator.read(), edmplugin::CacheParser.read(), BuildTrackerMapPlugin.read(), npstat::StorableMultivariateFunctor.read(), MixingModuleConfig.read(), npstat::UniformAxis.read(), LMap.read(), fastsim::NuclearInteraction.read(), edm::StreamerInputSource.read(), MuonResidualsTwoBin.read(), npstat::NUHistoAxis.read(), npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >.read(), edm::FileInPath.read(), npstat::DualAxis.read(), npstat::GridAxis.read(), npstat::HistoAxis.read(), npstat::DualHistoAxis.read(), npstat::StorableInterpolationFunctor< Numeric, Axis, Converter >.read(), MuonResidualsFitter.read(), npstat::LinInterpolatedTableND< Numeric, Axis >.read(), BitArray< N >.read(), DTTFBitArray< N >.read(), Vispa.Plugins.EdmBrowser.EdmDataAccessor.EdmDataAccessor.read(), and npstat::HistoND< Numeric, Axis >.read().

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

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

Definition at line 25 of file edmIntegrityCheck.py.

References FrontierConditions_GlobalTag_cff.file, edmIntegrityCheck.PublishToFileSystem.parent, confdb.HLTProcess.parent, EmDQMReco::FourVectorMonitorElements.parent, emtf::Node.parent, FWPSetTableManager::PSetData.parent, options.HLTProcessOptions.parent, BeautifulSoup.PageElement.parent, globcontrol.parent, and edm.print().

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

Definition at line 54 of file edmIntegrityCheck.py.

References FrontierConditions_GlobalTag_cff.file.

Referenced by edmIntegrityCheck.PublishToFileSystem.get().

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

Member Data Documentation

edmIntegrityCheck.PublishToFileSystem.parent

Definition at line 21 of file edmIntegrityCheck.py.

Referenced by Vispa.Gui.ConnectableWidget.ConnectableWidget.addMenuEntry(), Vispa.Views.LineDecayView.LineDecayContainer.applyFilter(), Vispa.Views.BoxDecayView.BoxDecayContainer.arrangeUsingRelations(), Vispa.Views.BoxDecayView.BoxDecayContainer.autolayoutAlgorithm(), Vispa.Gui.ZoomableScrollableWidgetOwner.ZoomableScrollableWidgetOwner.autosizeScrollArea(), Vispa.Views.BoxDecayView.BoxDecayContainer.autosizeScrollArea(), Vispa.Gui.PortWidget.PortWidget.connectionPoint(), Vispa.Main.StartupScreen.StartupScreen.createDescriptionWidget(), Vispa.Views.BoxDecayView.BoxDecayContainer.dataAccessor(), Vispa.Views.LineDecayView.LineDecayContainer.dataAccessor(), Vispa.Views.LineDecayView.DecayLine.dataAccessor(), Vispa.Views.LineDecayView.LineDecayContainer.delete(), Vispa.Views.LineDecayView.DecayNode.delete(), Vispa.Views.LineDecayView.DecayLine.delete(), Vispa.Gui.VispaWidget.VispaWidget.delete(), Vispa.Gui.VispaWidget.VispaWidget.dragWidget(), Vispa.Share.ImageExporter.ImageExporter.exportImageDialog(), Vispa.Views.LineDecayView.DecayLine.extendedSize(), edmIntegrityCheck.PublishToFileSystem.get(), Vispa.Gui.VispaWidget.VispaWidget.keyPressEvent(), Vispa.Gui.MenuWidget.MenuWidget.leaveEvent(), Vispa.Gui.ConnectableWidget.ConnectableWidget.leaveEvent(), Vispa.Gui.PortWidget.PortWidget.moduleParent(), Vispa.Gui.WidgetContainer.WidgetContainer.mouseDoubleClickEvent(), Vispa.Gui.VispaWidget.VispaWidget.mouseDoubleClickEvent(), Vispa.Gui.PortConnection.PointToPointConnection.mousePressEvent(), Vispa.Gui.VispaWidget.VispaWidget.mousePressEvent(), Vispa.Views.LineDecayView.ParticleWidget.mousePressEvent(), Vispa.Views.LineDecayView.DecayNode.move(), Vispa.Views.LineDecayView.LineDecayContainer.noDecorationsMode(), Vispa.Views.LineDecayView.LineDecayContainer.operationId(), Vispa.Views.LineDecayView.DecayLine.paint(), Vispa.Gui.VispaWidget.VispaWidget.paintEvent(), Vispa.Gui.ConnectableWidget.ConnectableWidget.positionizeMenuWidget(), edmIntegrityCheck.PublishToFileSystem.publish(), Vispa.Views.LineDecayView.DecayLine.qtLineStyle(), Vispa.Views.WidgetView.WidgetView.restoreSelection(), Vispa.Views.WidgetView.WidgetView.select(), Vispa.Gui.PortConnection.PointToPointConnection.select(), Vispa.Gui.VispaWidget.VispaWidget.select(), Vispa.Views.LineDecayView.LineDecayContainer.select(), Vispa.Views.LineDecayView.LineDecayContainer.sizeHint(), Vispa.Views.LineDecayView.LineDecayContainer.tabController(), Vispa.Views.BoxDecayView.BoxDecayContainer.toggleCollapsed(), Vispa.Views.LineDecayView.DecayNode.unite(), Vispa.Views.PropertyView.PropertyView.valueChanged(), Vispa.Views.BoxDecayView.BoxDecayContainer.widgetByObject(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner.widgetDoubleClicked(), and Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner.widgetDragged().