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

Constructor & Destructor Documentation

def edmIntegrityCheck.PublishToFileSystem.__init__ (   self,
  parent 
)

Definition at line 17 of file edmIntegrityCheck.py.

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

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, emtf::Node.parent, EmDQMReco::FourVectorMonitorElements.parent, FWPSetTableManager::PSetData.parent, options.HLTProcessOptions.parent, BeautifulSoup.PageElement.parent, globcontrol.parent, readConfig.fileINI.read(), cond::FileReader.read(), FileBlob.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(), SurveyPxbImageReader< T >.read(), pos::PixelROCDACSettings.read(), AlignmentParametersIO.read(), PythonProcessDesc.read(), bistream_iterator< T >.read(), RawFile.read(), l1t::LUT.read(), MixingInputConfig.read(), PedeReader.read(), edmIntegrityCheck.PublishToFileSystem.read(), FedRawDataInputSource.read(), CSCPairResidualsConstraint.read(), NuclearInteractionSimulator.read(), edmplugin::CacheParser.read(), DDStreamer.read(), BuildTrackerMapPlugin.read(), npstat::StorableMultivariateFunctor.read(), MixingModuleConfig.read(), npstat::UniformAxis.read(), LMap.read(), edm::StreamerInputSource.read(), MuonResidualsTwoBin.read(), npstat::NUHistoAxis.read(), npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >.read(), npstat::DualAxis.read(), edm::FileInPath.read(), npstat::GridAxis.read(), npstat::HistoAxis.read(), npstat::DualHistoAxis.read(), npstat::StorableInterpolationFunctor< Numeric, Axis, Converter >.read(), MuonResidualsFitter.read(), npstat::LinInterpolatedTableND< Numeric, Axis >.read(), DTTFBitArray< N >.read(), BitArray< 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  def get(self, dir):
62  """Finds the lastest file and reads it"""
63  reg = '^%s_.*\.txt$' % self.parent
64  files = castortools.matchingFiles(dir, reg)
65  files = sorted([ (os.path.basename(f), f) for f in files])
66  if not files:
67  return None
68  return self.read(files[-1][1])
69 
70 
def read(self, lfn, local=False)
def edmIntegrityCheck.PublishToFileSystem.publish (   self,
  report 
)
Publish a file

Definition at line 23 of file edmIntegrityCheck.py.

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

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

Definition at line 52 of file edmIntegrityCheck.py.

References FrontierConditions_GlobalTag_cff.file.

Referenced by edmIntegrityCheck.PublishToFileSystem.get().

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

Member Data Documentation

edmIntegrityCheck.PublishToFileSystem.parent

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