-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSubmitHadronizePythia8.py
executable file
·47 lines (38 loc) · 1.36 KB
/
SubmitHadronizePythia8.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/env python
import os
import subprocess
import sys
model = sys.argv[1]
InputFolder = sys.argv[2]
InputFile = sys.argv[3]
OutputFolder = sys.argv[4]
OutputFile = sys.argv[5]
startEntry = 0
endEntry = -1
if len(sys.argv)<=6 :
startEntry = 0
endEntry = -1
else :
startEntry = sys.argv[6]
endEntry = sys.argv[7]
wd = os.getcwd()
queue = '1nd'
#queue = '8nh'
#queue = '1nh' # -> not enough !?!?
#queue = '8nm' #--> not enough time!
newfol = 'makeHadronization_{MODEL}'.format(MODEL=model)
os.system('mkdir -p {PWD}/{NEW}'.format(PWD=wd,NEW=newfol))
if len(sys.argv) == 1:
print "uff, not enough information"
sys.exit(0)
command = '#!/bin/bash\n\
cd {PWD}\n\
./HadronizePythia8.sh {MODEL} {INPUTFOLDER} {INPUTFILE} {OUTPUTFOLDER} {OUTPUTFILE} {STARTENTRY} {ENDENTRY}\n \
'.format(PWD=wd, MODEL=model, INPUTFOLDER=InputFolder, INPUTFILE=InputFile, OUTPUTFOLDER=OutputFolder, OUTPUTFILE=OutputFile, STARTENTRY=startEntry, ENDENTRY=endEntry).replace(' ','')
fname = '/'.join([wd,newfol,'sub_'+model+'.sh'])
f1 = open(fname, 'w+')
print >> f1 , command
os.system('chmod 755 {FILE}'.format(FILE=fname))
f1.close()
fname = '/'.join([wd,newfol,'sub_'+model+'.sh'])
subprocess.Popen(['bsub -q {QUEUE} < {FILE}'.format(QUEUE=queue,FILE=fname)], stdout=subprocess.PIPE, shell=True)