Exemple #1
0
 def complete(self, result):
     state = self._state
     TaskState.set_result(state._id, result)
     if state.on_complete:
         msg = Message.m.get(_id=state.on_complete)
         if msg is not None:
             msg.send(result)
     if state.options.ignore_result and result.status == 'success':
         self.forget()
     else:
         self.refresh()
         chan = Message.channel.new_channel()
         chan.pub('complete', state._id)
Exemple #2
0
 def complete(self, result):
     state = self._state
     TaskState.set_result(state._id, result)
     if state.on_complete:
         msg = Message.m.get(_id=state.on_complete)
         if msg is not None:
             msg.send(result)
     if state.options.ignore_result and result.status == 'success':
         self.forget()
     else:
         self.refresh()
         chan = Message.channel.new_channel()
         chan.pub('complete', state._id)
Exemple #3
0
 def new(cls, data, status='pending', **options):
     options.setdefault('path', getattr(g, 'path', None))
     state = TaskState.make(dict(
         type=cls.name,
         status=status,
         options=options,
         data=data))
     state.m.insert()
     return cls(state)
Exemple #4
0
 def new(cls, data, status='pending', **options):
     state = TaskState.make(
         dict(type=cls.name, status=status, options=options, data=data))
     state.m.insert()
     return cls(state)
Exemple #5
0
 def new(cls, data, status='pending', **options):
     options.setdefault('path', getattr(g, 'path', None))
     state = TaskState.make(
         dict(type=cls.name, status=status, options=options, data=data))
     state.m.insert()
     return cls(state)
Exemple #6
0
 def new(cls, data, status="pending", **options):
     state = TaskState.make(dict(type=cls.name, status=status, options=options, data=data))
     state.m.insert()
     return cls(state)