CMS 3D CMS Logo

Classes | Functions | Variables
hippyaddtobaddatafiles Namespace Reference

Classes

class  KeepWhileOpenFile
 
class  OneAtATime
 

Functions

def abspath (path)
 
def cd (newdir)
 
def cdtemp ()
 
def runcfg (cfgfile, badfilelist)
 

Variables

 args
 
 badfilelist
 
 default
 
 nargs
 
 p
 
 type
 

Function Documentation

def hippyaddtobaddatafiles.abspath (   path)

Definition at line 8 of file hippyaddtobaddatafiles.py.

8  def abspath(path):
9  if not os.path.exists(path): raise ValueError(path+" does not exist")
10  return os.path.abspath(path)
11 
def hippyaddtobaddatafiles.cd (   newdir)
http://stackoverflow.com/a/24176022/5228524

Definition at line 40 of file hippyaddtobaddatafiles.py.

Referenced by hippyaddtobaddatafiles.KeepWhileOpenFile.__enter__(), hippyaddtobaddatafiles.KeepWhileOpenFile.__exit__(), SiStripTFile.addDevice(), plotscripts.bellcurves(), ZeePlots.bookZHistograms(), ZeePlots.bookZMCHistograms(), plotTTrigFromHistos.compareDiff(), plotT0FromHistos.compareDiff(), plotscripts.corrections2D(), HtrXmlPatternTool.createHists(), plotscripts.DBdiff(), HtrXmlPattern.do_hand_fill(), HtrXmlPatternTool.Fill(), CACell.haveSimilarCurvature(), edm::service::MessageLoggerDefaults.limit(), DQMGenericClient.makeCumulativeDist(), DQMStore.meBookerGetter(), ZeePlots.openFile(), FWColorPopup.PlacePopup(), python.rootplot.core.plot_hists_root(), plotResidualsPerLayer.plotFromFile(), plotscripts.plotmedians(), plotscripts.polynomials(), edm::PrintEventSetupContent.print(), HcalTestAnalysis.qieAnalysis(), HcalTB04Analysis.qieAnalysis(), DQMStore::IGetter.removeElement(), edm::service::MessageLoggerDefaults.reportEvery(), histoStyle.savePlots(), plotscripts.segdiff(), plotscripts.segdiff_xalign(), HitDigitizerFP420.setChargeCollectionDrifter(), HitDigitizerFP420.setChargeDivider(), HitDigitizerFP420.setInduceChargeOnElectrods(), TagProbeFitter.setWeightVar(), edm::service::MessageLoggerDefaults.sev_limit(), edm::service::MessageLoggerDefaults.sev_reportEvery(), edm::service::MessageLoggerDefaults.sev_timespan(), edm::service::MessageLoggerDefaults.timespan(), HMassResolutionVSPart.Write(), ZeeRescaleFactorPlots.writeHistograms(), HtrXmlPatternTool.writeXML(), and TFileDirectory.~TFileDirectory().

40 def cd(newdir):
41  """http://stackoverflow.com/a/24176022/5228524"""
42  prevdir = os.getcwd()
43  os.chdir(os.path.expanduser(newdir))
44  try:
45  yield
46  finally:
47  os.chdir(prevdir)
48 
def hippyaddtobaddatafiles.cdtemp ( )

Definition at line 49 of file hippyaddtobaddatafiles.py.

Referenced by hippyaddtobaddatafiles.OneAtATime.__enter__().

49 def cdtemp(): return cd(tempfile.mkdtemp())
50 
def hippyaddtobaddatafiles.runcfg (   cfgfile,
  badfilelist 
)

Definition at line 17 of file hippyaddtobaddatafiles.py.

References edmIntegrityCheck.group, join(), edm.print(), and split.

17 def runcfg(cfgfile, badfilelist):
18  try:
19  subprocess.check_output(["cmsRun", cfgfile], stderr=subprocess.STDOUT)
20  except subprocess.CalledProcessError as e:
21  if "FallbackFileOpenError" in e.output:
22  output = e.output.split("An exception of category 'FallbackFileOpenError' occurred while")[1]
23  filename = re.search("Failed to open the file '[^']*(/store/.*[.]root)", output).group(1)
24  with OneAtATime(badfilelist+".tmp", 2) as f:
25  with open(badfilelist) as f:
26  contents = set(f.read().split())
27  if filename in contents:
28  raise RuntimeError(filename+"\nis already in\n"+badfilelist+"\n\nExiting to avoid an infinite loop. Maybe you have this running on the same cfg file multiple times?")
29  contents.add(filename)
30  contents = sorted(contents)
31  with open(badfilelist, "w") as f:
32  f.write("\n".join(contents)+"\n")
33  print("found and added a bad file:\n"+filename)
34  else:
35  raise
36  return runcfg(cfgfile, badfilelist)
37  print("all files left are good")
38 
39 @contextlib.contextmanager
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
def runcfg(cfgfile, badfilelist)
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
double split
Definition: MVATrainer.cc:139

Variable Documentation

hippyaddtobaddatafiles.args

Definition at line 15 of file hippyaddtobaddatafiles.py.

hippyaddtobaddatafiles.badfilelist

Definition at line 123 of file hippyaddtobaddatafiles.py.

hippyaddtobaddatafiles.default

Definition at line 14 of file hippyaddtobaddatafiles.py.

hippyaddtobaddatafiles.nargs

Definition at line 14 of file hippyaddtobaddatafiles.py.

hippyaddtobaddatafiles.p

Definition at line 12 of file hippyaddtobaddatafiles.py.

hippyaddtobaddatafiles.type

Definition at line 13 of file hippyaddtobaddatafiles.py.