--- a/iro/model/job.py Fri Mar 23 16:22:32 2012 +0100
+++ b/iro/model/job.py Fri Mar 23 16:23:29 2012 +0100
@@ -1,5 +1,4 @@
-from twisted.python import log
-from twisted.python import threadable
+from twisted.python import log, threadable
from datetime import datetime
from collections import MutableMapping
@@ -21,6 +20,7 @@
self.tasks={}
self.c = 0
self.status = "started"
+ log.msg("Job(%s) created."%(self.dbjob))
def addTask(self,task):
self.tasks[task.recipient] = task
@@ -37,6 +37,7 @@
return
job.status = status
self.status = status
+ log.msg("Job(%s) status changed to: %s."%(self.dbjob, status))
session.commit()
@dbdefer
@@ -44,10 +45,10 @@
c = self.incStatus()
job = schema.Job.get(session, self.dbjob)
- if job.status in ["started","init"]:
- self._status(session,"sending")
if c == len(self.recipients):
self._status(session,"sended")
+ elif job.status in ["started","init"]:
+ self._status(session,"sending")
if status.costs > 0:
o = schema.Offer.get(session, status.provider.name, status.route, self.message.typ)