Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 21afba9

Browse files
committed
got the partial output finally properly replaced by complete output in IPC database - #297
1 parent 5c83358 commit 21afba9

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

lib/utils/api.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,15 @@ def write(self, value, status=CONTENT_STATUS.IN_PROGRESS, content_type=None):
187187
# Ignore all non-relevant messages
188188
return
189189

190-
output = conf.database_cursor.execute("SELECT id, value FROM data WHERE taskid = ? AND status = ? AND content_type = ? LIMIT 0,1",
191-
(self.taskid, status, content_type))
190+
#print >>sys.__stdout__, "value: %s\nstatus: %d\ncontent_type: %d\nkb.partRun: %s\n--------------" % (value, status, content_type, kb.partRun)
191+
192+
output = conf.database_cursor.execute("SELECT id, value FROM data WHERE taskid = ? AND content_type = ?",
193+
(self.taskid, content_type))
192194

193195
# Delete partial output from IPC database if we have got a complete output
194196
if status == CONTENT_STATUS.COMPLETE and len(output) > 0:
195-
conf.database_cursor.execute("DELETE FROM data WHERE id=?", (output[0][0],))
197+
for index in xrange(0, len(output)-1):
198+
conf.database_cursor.execute("DELETE FROM data WHERE id = ?", (output[index][0],))
196199

197200
if kb.partRun:
198201
kb.partRun = None

0 commit comments

Comments
 (0)