CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 14 of file edmIntegrityCheck.py.

Constructor & Destructor Documentation

def edmIntegrityCheck.PublishToFileSystem.__init__ (   self,
  parent 
)

Definition at line 17 of file edmIntegrityCheck.py.

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

Member Function Documentation

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

Definition at line 61 of file edmIntegrityCheck.py.

References edmIntegrityCheck.PublishToFileSystem.parent, confdb.HLTProcess.parent, Node.parent, EmDQMReco::FourVectorMonitorElements.parent, FWPSetTableManager::PSetData.parent, options.HLTProcessOptions.parent, globcontrol.parent, TiXmlNode.parent, readConfig.fileINI.read(), cond::FileReader.read(), FileBlob.read(), MillePedeFileReader.read(), AlignmentCorrelationsIO.read(), ora::IBlobStreamingService.read(), edm::RawInputSource.read(), pos::PixelROCMaskBits.read(), pos::PixelROCTrimBits.read(), AlignmentCorrelationsIORoot.read(), SimBeamSpotObjects.read(), MultiFileBlob.read(), ora::QVReader.read(), LMap::impl.read(), pos::PixelROCDACSettings.read(), AlignmentUserVariablesIO.read(), personalPlayback.Applet.read(), SurveyPxbImageReader< T >.read(), AlignmentParametersIO.read(), PythonProcessDesc.read(), bistream_iterator< T >.read(), l1t::LUT.read(), MixingInputConfig.read(), RawFile.read(), PedeReader.read(), edmIntegrityCheck.PublishToFileSystem.read(), ora::PVectorReader.read(), FedRawDataInputSource.read(), CSCPairResidualsConstraint.read(), NuclearInteractionSimulator.read(), edmplugin::CacheParser.read(), DDStreamer.read(), ora::OraPtrReadBuffer.read(), ora::IRelationalReader.read(), BuildTrackerMapPlugin.read(), npstat::StorableMultivariateFunctor.read(), ora::QueryableVectorReader.read(), MixingModuleConfig.read(), ora::PrimitiveReader.read(), ora::OraReferenceReader.read(), npstat::UniformAxis.read(), LMap.read(), ora::BlobReader.read(), ora::OraPtrReader.read(), ora::UniqueRefReader.read(), ora::CArrayReader.read(), ora::InlineCArrayReader.read(), edm::StreamerInputSource.read(), ora::ObjectReader.read(), ora::STLContainerReader.read(), ora::NamedRefReader.read(), MuonResidualsTwoBin.read(), ora::DependentClassReader.read(), npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >.read(), npstat::NUHistoAxis.read(), npstat::DualAxis.read(), edm::FileInPath.read(), npstat::GridAxis.read(), npstat::HistoAxis.read(), npstat::DualHistoAxis.read(), npstat::StorableInterpolationFunctor< Numeric, Axis, Converter >.read(), ora::ReadBuffer.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().

61 
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 
def edmIntegrityCheck.PublishToFileSystem.publish (   self,
  report 
)
Publish a file

Definition at line 23 of file edmIntegrityCheck.py.

References mergeVDriftHistosByStation.file, edmIntegrityCheck.PublishToFileSystem.parent, confdb.HLTProcess.parent, Node.parent, EmDQMReco::FourVectorMonitorElements.parent, FWPSetTableManager::PSetData.parent, options.HLTProcessOptions.parent, globcontrol.parent, and TiXmlNode.parent.

23 
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)
def edmIntegrityCheck.PublishToFileSystem.read (   self,
  lfn,
  local = False 
)
Reads a report from storage

Definition at line 52 of file edmIntegrityCheck.py.

References mergeVDriftHistosByStation.file.

Referenced by edmIntegrityCheck.PublishToFileSystem.get().

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

Member Data Documentation

edmIntegrityCheck.PublishToFileSystem.parent

Definition at line 19 of file edmIntegrityCheck.py.

Referenced by BeautifulSoup.PageElement._invert(), 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(), argparse.HelpFormatter._Section.format_help(), python.rootplot.argparse.HelpFormatter._Section.format_help(), 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().