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

◆ abspath()

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 

◆ cd()

def hippyaddtobaddatafiles.cd (   newdir)
http://stackoverflow.com/a/24176022/5228524

Definition at line 40 of file hippyaddtobaddatafiles.py.

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 

Referenced by hippyaddtobaddatafiles.KeepWhileOpenFile.__enter__(), hippyaddtobaddatafiles.KeepWhileOpenFile.__exit__(), SiStripTFile.addDevice(), plotting.Frame.adjustMarginLeft(), plotting.FrameRatio.adjustMarginLeft(), plotting.Frame.adjustMarginRight(), plotting.FrameRatio.adjustMarginRight(), plotting.FrameTGraph2D.adjustMarginRight(), plotscripts.bellcurves(), plotTTrigFromHistos.compareDiff(), plotT0FromHistos.compareDiff(), plotscripts.corrections2D(), HtrXmlPatternTool.createHists(), plotscripts.DBdiff(), HtrXmlPattern.do_hand_fill(), edm::eventsetup::EventSetupRecord.doGet(), DisplayManager.DisplayManager.Draw(), TkAlMap.TkAlMap.draw_cms_prelim(), TkAlMap.TkAlMap.draw_color_bar(), TkAlMap.TkAlMap.draw_event_info(), TkAlMap.TkAlMap.draw_text(), TkAlMap.TkAlMap.draw_title(), TkAlMap.TkAlMap.draw_TPL(), HtrXmlPatternTool.Fill(), SensitiveDetector.FinalStepPosition(), CACell.haveSimilarCurvature(), SensitiveDetector.InitialStepPosition(), edm::service::MessageLoggerDefaults.limit(), DQMGenericClient.makeCumulativeDist(), FWColorPopup.PlacePopup(), python.rootplot.core.plot_hists_root(), plotResidualsPerLayer.plotFromFile(), plotscripts.plotmedians(), plotscripts.polynomials(), edm::PrintEventSetupContent.print(), HcalTestAnalysis.qieAnalysis(), HcalTB04Analysis.qieAnalysis(), plotting.FrameRatio.redrawAxis(), edm::service::MessageLoggerDefaults.reportEvery(), histoStyle.savePlots(), plotscripts.segdiff(), plotscripts.segdiff_xalign(), HitDigitizerFP420.setChargeCollectionDrifter(), SiHitDigitizer.setChargeCollectionDrifter(), HitDigitizerFP420.setChargeDivider(), SiHitDigitizer.setChargeDivider(), HitDigitizerFP420.setInduceChargeOnElectrods(), SiHitDigitizer.setInduceChargeOnStrips(), edm::service::MessageLoggerDefaults.sev_limit(), edm::service::MessageLoggerDefaults.sev_reportEvery(), edm::service::MessageLoggerDefaults.sev_timespan(), edm::service::MessageLoggerDefaults.timespan(), HMassResolutionVSPart.Write(), DQMIO2histo.DQMIO.write_to_file(), and HtrXmlPatternTool.writeXML().

◆ cdtemp()

def hippyaddtobaddatafiles.cdtemp ( )

Definition at line 49 of file hippyaddtobaddatafiles.py.

49 def cdtemp(): return cd(tempfile.mkdtemp())
50 

Referenced by hippyaddtobaddatafiles.OneAtATime.__enter__().

◆ runcfg()

def hippyaddtobaddatafiles.runcfg (   cfgfile,
  badfilelist 
)

Definition at line 17 of file hippyaddtobaddatafiles.py.

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

References watchdog.group, join(), print(), and submitPVValidationJobs.split().

Variable Documentation

◆ args

hippyaddtobaddatafiles.args

Definition at line 15 of file hippyaddtobaddatafiles.py.

◆ badfilelist

hippyaddtobaddatafiles.badfilelist

Definition at line 123 of file hippyaddtobaddatafiles.py.

◆ default

hippyaddtobaddatafiles.default

Definition at line 14 of file hippyaddtobaddatafiles.py.

◆ nargs

hippyaddtobaddatafiles.nargs

Definition at line 14 of file hippyaddtobaddatafiles.py.

◆ p

hippyaddtobaddatafiles.p

Definition at line 12 of file hippyaddtobaddatafiles.py.

◆ type

hippyaddtobaddatafiles.type

Definition at line 13 of file hippyaddtobaddatafiles.py.

hippyaddtobaddatafiles.abspath
def abspath(path)
Definition: hippyaddtobaddatafiles.py:8
hippyaddtobaddatafiles.runcfg
def runcfg(cfgfile, badfilelist)
Definition: hippyaddtobaddatafiles.py:17
join
static std::string join(char **cmd)
Definition: RemoteFile.cc:17
submitPVValidationJobs.split
def split(sequence, size)
Definition: submitPVValidationJobs.py:352
print
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:46
hippyaddtobaddatafiles.cd
def cd(newdir)
Definition: hippyaddtobaddatafiles.py:40
hippyaddtobaddatafiles.cdtemp
def cdtemp()
Definition: hippyaddtobaddatafiles.py:49
watchdog.group
group
Definition: watchdog.py:82