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

Constructor & Destructor Documentation

def edmIntegrityCheck.PublishToFileSystem.__init__ (   self,
  parent 
)

Definition at line 18 of file edmIntegrityCheck.py.

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

Member Function Documentation

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

Definition at line 62 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(), personalPlayback.Applet.read(), AlignmentUserVariablesIO.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(), edmplugin::CacheParser.read(), NuclearInteractionSimulator.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(), betterConfigParser.BetterConfigParser.getGeneral(), and betterConfigParser.BetterConfigParser.getResultingSection().

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

Definition at line 24 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, and globcontrol.parent.

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

Definition at line 53 of file edmIntegrityCheck.py.

References FrontierConditions_GlobalTag_cff.file.

Referenced by edmIntegrityCheck.PublishToFileSystem.get().

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

Member Data Documentation

edmIntegrityCheck.PublishToFileSystem.parent

Definition at line 20 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().