Fix node IDs in subjobs.
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Thu, 5 Mar 2015 20:02:45 +0000 (21:02 +0100)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Thu, 5 Mar 2015 20:02:45 +0000 (21:02 +0100)
jobs.py

diff --git a/jobs.py b/jobs.py
index ebd97fa..d6ebdce 100755 (executable)
--- a/jobs.py
+++ b/jobs.py
@@ -376,6 +376,7 @@ for id, job in jobs.iteritems():
                                                if regAtt.match(attempt['id']): attempt['id'] = regAtt.sub('', attempt['id'])
 
                                                nodeHost = regHost.sub('', attempt['nodeHttpAddress'])
+                                               attempt['nodeHttpAddress'] = nodeHost
                                                if nodeHost not in jobnodes:
                                                        jobnodes[nodeHost] = JobNode()
                                                jobnodes[nodeHost].elapsed += attempt['elapsedTime']
@@ -410,6 +411,7 @@ for id, job in jobs.iteritems():
 
                st.execute("DELETE FROM subjobs WHERE jobid=%s", id)
                for subjob in subjobs:
+                       nodename = subjob['nodeHttpAddress']
                        st.execute('INSERT INTO subjobs (id, jobid, nodeid, state, type, start, finish) VALUES (%s, %s, %s, %s, %s, %s, %s)', (subjob['id'], id, node_hosts[nodename].id, subjob['state'], subjob['type'], subjob['startTime'], subjob['finishTime']))
                if debug >= 2: print '[db] job %s subjobs updated' % id