-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_allgrids.py
executable file
·43 lines (37 loc) · 1.07 KB
/
run_allgrids.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
#!/usr/bin/python
from mergecommon import *
import sqlite3 as lite
import sys,os
from subprocess import call
def infoSplash():
print('Usage: ' + sys.argv[0] + " [theoryID] [run script]")
exit(-1)
if len(sys.argv) != 3:
infoSplash()
theoryID = sys.argv[1]
runScript = sys.argv[2]
currentPath = os.path.dirname(os.path.realpath(__file__))
sqlite3Path = currentPath+'/db/apfelcomb.db'
# sqlite con
con = None
try:
# Setup sql connection
con = lite.connect(sqlite3Path)
cur = con.cursor()
cur.execute('SELECT name, source FROM grids ORDER BY id' )
grids = cur.fetchall()
for grid in grids:
source = grid[1]
target = grid[0]
subgrids = get_subgrids(source, target, cur)
missing = get_missing(subgrids, theoryID, target)
for table in missing:
runcmd = runScript+' '+source.lower()+" "+str(table) + " " + str(theoryID)
print(target + ' ' + str(table))
os.system(runcmd)
except lite.Error, e:
print("Error %s:" % e.args[0])
sys.exit(1)
finally:
if con:
con.close()