python/dna/apy/worker.py
def delete(self, worker_id):
        ''' Stop and remove a worker '''
        code = 200

        if worker_id in self.jobs:
            # NOTE pop it if done ?
            self.jobs[worker_id]['worker'].revoke(terminate=True)
            report = {
                'id': worker_id,
                'revoked': True
                # FIXME Unable to serialize self.jobs[worker_id]
                # 'session': self.jobs.pop(worker_id)
            }
            self.jobs.pop(worker_id)
        else:
            report = {'error': 'job {} unknown'.format(worker_id)}
            code = 404

        return flask.jsonify(report), code
def delete(self, worker_id):
        ''' Stop and remove a worker '''
        code = 200

        if worker_id in self.jobs:
            # NOTE pop it if done ?
            self.jobs[worker_id]['worker'].revoke(terminate=True)
            report = {
                'id': worker_id,
                'revoked': True
                # FIXME Unable to serialize self.jobs[worker_id]
                # 'session': self.jobs.pop(worker_id)
            }
            self.jobs.pop(worker_id)
        else:
            report = {'error': 'job {} unknown'.format(worker_id)}
            code = 404

        return flask.jsonify(report), code
Stop and remove a worker