forked from msoos/cryptominisat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfile_creator.py
executable file
·62 lines (49 loc) · 1.69 KB
/
file_creator.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import MySQLdb as mdb
import ntpath
import subprocess
import time
con = mdb.connect('localhost', 'cmsat_presenter', '', 'cmsat');
version = "dc65769cfcba9c2bb52ee81dbea39830ad28bb1b"
with con:
cur = con.cursor(mdb.cursors.DictCursor)
query = """
SELECT
startup.runID as runid
, startup.startTime as start
, finishup.endTime as end
, UNIX_TIMESTAMP(finishup.endTime)-UNIX_TIMESTAMP(startup.startTime) as diff
, tags.tag as fname
FROM startup, finishup, solverRun, tags
WHERE startup.runID = solverRun.runID
and startup.runID = tags.runID
and startup.runID = finishup.runID
and tagname = "filename"
and solverRun.version = '%s'
order by diff asc
""" % version
query_all = """
SELECT
startup.runID as runid
, startup.startTime as start
, tags.tag as fname
FROM startup, solverRun, tags
WHERE startup.runID = solverRun.runID
and startup.runID = tags.runID
and tagname = "filename"
and solverRun.version = '%s'
""" % version
cur.execute(query_all)
start = time.time()
for i in range(cur.rowcount):
row = cur.fetchone()
#print row['diff'], row['runid'], ntpath.basename(row['fname'])
toexec="""
export QUERY_STRING="id=%d" ;
php -e -r 'parse_str($_SERVER["QUERY_STRING"], $_GET); include "get_data.php";'
""" % (row['runid'])
into = open("dat/" + ntpath.basename(row['fname']) + ".dat", "w")
subprocess.call(toexec, shell=True, stdout=into)
into.close()
print "%d/%d done %2.2f perc, %2.2f s" % (i+1, cur.rowcount, float(i+1.0)/float(cur.rowcount)*100.0, time.time()-start)