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)
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)
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)
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)
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)