Commit f4651591 authored by Pascal Meunier's avatar Pascal Meunier

MiddlewareTime squid field accounting for nanoHUB

parent a79ab4e7
......@@ -835,8 +835,6 @@ class Session:
def parse_time(self, db, line, zone_id=0):
"""Parse a time specification for a subtask."""
#log("parse_time")
event = ""
job = 0
start = 0.0
......@@ -845,7 +843,7 @@ class Session:
ncpus = 1
venue = ""
status = 0
squid = ""
for item in line.split():
try:
if item == 'MiddlewareTime:':
......@@ -870,6 +868,11 @@ class Session:
venue = v
elif k == 'status':
status = int(v)
elif k == 'squid':
# expecting string like toolname/revision/hashkey
if re.match('\A[a-z0-9_\-]+/[0-9]+/[a-z0-9]{40}\Z', v) is None:
continue
squid = v
else:
log("Unknown tag in parse_time: %s" % k)
continue
......@@ -893,12 +896,22 @@ class Session:
[self.sessnum, job, event, venue])
if row is None:
db.c.execute("""
INSERT INTO
joblog(sessnum,job,event,start,walltime,cputime,ncpus,status,venue)
SELECT sessnum, %s, %s, """ + start + """, %s, %s, %s, %s, %s
FROM sessionlog WHERE sessnum=%s""",
[job, event, wall, cpu, ncpus, status, venue, self.sessnum])
if squid == "":
# do standard joblog update without "squid" field
db.c.execute("""
INSERT INTO
joblog(sessnum,job,event,start,walltime,cputime,ncpus,status,venue)
SELECT sessnum, %s, %s, """ + start + """, %s, %s, %s, %s, %s
FROM sessionlog WHERE sessnum=%s""",
[job, event, wall, cpu, ncpus, status, venue, self.sessnum])
else:
# for nanoHUB: update with "squid" caching field
db.c.execute("""
INSERT INTO
joblog(sessnum,job,event,start,walltime,cputime,ncpus,status,venue,squid)
SELECT sessnum, %s, %s, """ + start + """, %s, %s, %s, %s, %s, %s
FROM sessionlog WHERE sessnum=%s""",
[job, event, wall, cpu, ncpus, status, venue, squid, self.sessnum])
else:
if row[0] == '0000-00-00 00:00:00' or row[0] is None:
print "fixing start for a job in session %d" % row[1]
......@@ -909,7 +922,6 @@ class Session:
else:
print row
def sum_viewtime(self, db):
"""Sum the view time for a session."""
debug_viewtime = 0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment