Logo coherent WaveBurst  
Config Reference Guide
Logo
parallelNotebooks.py
Go to the documentation of this file.
1 try:
2  import dagger
3  from joblib import Parallel, delayed
4  import subprocess
5  import multiprocessing
6  import os
7 
8  outDir = os.environ["DOXYGEN_NOTEBOOK_PATH_PARALLEL"]
9 
10  inputs = [input.replace("../../tutorials/", "") for input in subprocess.check_output(["grep", "-r", "-l", "/// \\\\notebook\|## \\\\notebook", os.path.expandvars("$DOXYGEN_SOURCE_DIRECTORY/tutorials")]).split()]
11 
12  dependenciesgraph = dagger.dagger()
13 
14  for element in inputs:
15  dependenciesgraph.add(element)
16 
17  dependenciesgraph.add("math/testUnfold5d.C",["math/testUnfold5c.C"])
18  dependenciesgraph.add("math/testUnfold5c.C",["math/testUnfold5b.C"])
19  dependenciesgraph.add("math/testUnfold5b.C",["math/testUnfold5a.C"])
20  dependenciesgraph.add("xml/xmlreadfile.C",["xml/xmlnewfile.C"])
21  dependenciesgraph.add("roofit/rf503_wspaceread.C",["roofit/rf502_wspacewrite.C"])
22  dependenciesgraph.add("io/readCode.C",["io/importCode.C"])
23  dependenciesgraph.add("fit/fit1.C",["hist/fillrandom.C"])
24  dependenciesgraph.add("fit/myfit.C",["fit/fitslicesy.C"])
25  dependenciesgraph.add("foam/foam_demopers.C",["foam/foam_demo.C"])
26  dependenciesgraph.add("tree/staff.C",["tree/cernbuild.C"])
27  dependenciesgraph.add("tree/cernstaff.C",["tree/cernbuild.C"])
28  dependenciesgraph.add("hist/hbars.C",["tree/cernbuild.C"])
29  dependenciesgraph.add("pyroot/ntuple1.py",["pyroot/hsimple.py"])
30  dependenciesgraph.add("pyroot/h1draw.py",["pyroot/hsimple.py"])
31  dependenciesgraph.add("pyroot/fit1.py",["pyroot/fillrandom.py"])
32  dependenciesgraph.add("tmva/TMVAClassificationApplication.C",["tmva/TMVAClassification.C"])
33  dependenciesgraph.add("tmva/TMVAClassificationCategory.C",["tmva/TMVAClassification.C"])
34  dependenciesgraph.add("tmva/TMVAClassificationCategoryApplication.C",["tmva/TMVAClassificationCategory.C"])
35  dependenciesgraph.add("tmva/TMVAMulticlass.C",["tmva/TMVAMultipleBackgroundExample.C"])
36  dependenciesgraph.add("tmva/TMVAMulticlassApplication.C",["tmva/TMVAMulticlass.C"])
37  dependenciesgraph.add("tmva/TMVARegressionApplication.C",["tmva/TMVARegression.C"])
38 
39  for node in dependenciesgraph.nodes:
40  dependenciesgraph.stale(node)
41 
42  dependenciesgraph.run()
43 
44  iterator = dependenciesgraph.iter()
45 
46  newinputs = []
47  while len(iterator)>0:
48  todo = iterator.next(10000)
49  newinputs.append(todo)
50  # print todo
51  for element in todo:
52  iterator.remove(element)
53 
54  for i in newinputs:
55  print i
56 
57  def processInput(inputFile):
58  subprocess.call(['python',
59  './converttonotebook.py',
60  os.path.join(os.environ['DOXYGEN_SOURCE_DIRECTORY'], 'tutorials', inputFile),
61  outDir])
62 
63  num_cores = multiprocessing.cpu_count()
64 
65  def parallel(input):
66  Parallel(n_jobs=num_cores,verbose=100)(delayed(processInput)(i) for i in input)
67 
68  for input in newinputs:
69  parallel(input)
70 
71 except:
72  print 'Parallel notebooks converter failed!!'
73  pass
def processInput(inputFile)