equal
deleted
inserted
replaced
8 #without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
8 #without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
9 #See the GNU General Public License for more details. |
9 #See the GNU General Public License for more details. |
10 |
10 |
11 #You should have received a copy of the GNU General Public License |
11 #You should have received a copy of the GNU General Public License |
12 #along with this program; if not, see <http://www.gnu.org/licenses/>. |
12 #along with this program; if not, see <http://www.gnu.org/licenses/>. |
13 |
|
14 import logging |
|
15 logger=logging.getLogger("job") |
|
16 |
13 |
17 class Job(object): |
14 class Job(object): |
18 ''' |
15 ''' |
19 Basic class for all jobs |
16 Basic class for all jobs |
20 ''' |
17 ''' |
30 self.id=id |
27 self.id=id |
31 self.status = "started" |
28 self.status = "started" |
32 |
29 |
33 def stop(self): |
30 def stop(self): |
34 self.status = "stopped" |
31 self.status = "stopped" |
|
32 |
|
33 def setLog(self,log): |
|
34 self.log=log |
35 |
35 |
36 def getStatus(self,detailed=False): |
36 def getStatus(self,detailed=False): |
37 if detailed and self.status == "started" or self.status == "sended": |
37 if detailed and self.status == "started" or self.status == "sended": |
38 return self.status, self.dStatus |
38 return self.status, self.dStatus |
39 return self.status,{} |
39 return self.status,{} |
46 |
46 |
47 def getProvider(self): |
47 def getProvider(self): |
48 return None |
48 return None |
49 |
49 |
50 def addGood(self, good): |
50 def addGood(self, good): |
51 logger.debug('Job(%d)-send to %s'%(self.id, str(good))) |
|
52 if type(good) == list: |
51 if type(good) == list: |
53 self.dStatus['good']=self.dStatus['good']+good |
52 self.dStatus['good']=self.dStatus['good']+good |
54 else: |
53 else: |
55 self.dStatus['good'].append(good) |
54 self.dStatus['good'].append(good) |
56 |
55 |
57 def addFailed(self, failed): |
56 def addFailed(self, failed): |
58 logger.debug('Job(%d)-faild to send to %s'%(self.id, str(failed))) |
|
59 if type(failed) == list: |
57 if type(failed) == list: |
60 self.dStatus['failed']=self.dStatus['failed']+failed |
58 self.dStatus['failed']=self.dStatus['failed']+failed |
61 else: |
59 else: |
62 self.dStatus['failed'].append(failed) |
60 self.dStatus['failed'].append(failed) |
63 |
61 |