CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Functions | Variables
hippyaddtobaddatafiles Namespace Reference

Classes

class  KeepWhileOpenFile
 
class  OneAtATime
 

Functions

def abspath
 
def cd
 
def cdtemp
 
def runcfg
 

Variables

tuple args = p.parse_args()
 
 badfilelist = args.badfilelist
 
tuple p = argparse.ArgumentParser()
 

Function Documentation

def hippyaddtobaddatafiles.abspath (   path)

Definition at line 8 of file hippyaddtobaddatafiles.py.

8 
9  def abspath(path):
10  if not os.path.exists(path): raise ValueError(path+" does not exist")
11  return os.path.abspath(path)
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(), plotTTrigFromHistos.compareDiff(), plotT0FromHistos.compareDiff(), plotscripts.corrections2D(), plotscripts.DBdiff(), HtrXmlPattern.do_hand_fill(), edm::eventsetup::EventSetupRecord.doGet(), HtrXmlPatternTool.Fill(), CACell.haveSimilarCurvature(), 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(), edm::service::MessageLoggerDefaults.reportEvery(), histoStyle.savePlots(), plotscripts.segdiff(), plotscripts.segdiff_xalign(), HitDigitizerFP420.setChargeCollectionDrifter(), HitDigitizerFP420.setChargeDivider(), HitDigitizerFP420.setInduceChargeOnElectrods(), edm::service::MessageLoggerDefaults.sev_limit(), edm::service::MessageLoggerDefaults.sev_reportEvery(), edm::service::MessageLoggerDefaults.sev_timespan(), edm::service::MessageLoggerDefaults.timespan(), and HMassResolutionVSPart.Write().

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

Definition at line 49 of file hippyaddtobaddatafiles.py.

Referenced by hippyaddtobaddatafiles.OneAtATime.__enter__().

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

Definition at line 17 of file hippyaddtobaddatafiles.py.

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

17 
18 def runcfg(cfgfile, badfilelist):
19  try:
20  subprocess.check_output(["cmsRun", cfgfile], stderr=subprocess.STDOUT)
21  except subprocess.CalledProcessError as e:
22  if "FallbackFileOpenError" in e.output:
23  output = e.output.split("An exception of category 'FallbackFileOpenError' occurred while")[1]
24  filename = re.search("Failed to open the file '[^']*(/store/.*[.]root)", output).group(1)
25  with OneAtATime(badfilelist+".tmp", 2) as f:
26  with open(badfilelist) as f:
27  contents = set(f.read().split())
28  if filename in contents:
29  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?")
30  contents.add(filename)
31  contents = sorted(contents)
32  with open(badfilelist, "w") as f:
33  f.write("\n".join(contents)+"\n")
34  print("found and added a bad file:\n"+filename)
35  else:
36  raise
37  return runcfg(cfgfile, badfilelist)
38  print("all files left are good")
39 
@contextlib.contextmanager
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
tuple group
Definition: watchdog.py:82
static std::string join(char **cmd)
Definition: RemoteFile.cc:19

Variable Documentation

tuple hippyaddtobaddatafiles.args = p.parse_args()

Definition at line 15 of file hippyaddtobaddatafiles.py.

tuple hippyaddtobaddatafiles.badfilelist = args.badfilelist

Definition at line 123 of file hippyaddtobaddatafiles.py.

tuple hippyaddtobaddatafiles.p = argparse.ArgumentParser()

Definition at line 12 of file hippyaddtobaddatafiles.py.