def delete_worker(cls, actor_id, worker_id): """Deletes a worker from the worker store. Uses Redis optimistic locking to provide thread-safety since multiple clients could be attempting to delete workers at the same time. Pass db_id as `actor_id` parameter. """ try: wk = workers_store.pop_field(actor_id, worker_id) except KeyError: raise errors.WorkerException("Worker not found.")
def delete_worker(cls, actor_id, worker_id): """Deletes a worker from the worker store. Uses Redis optimistic locking to provide thread-safety since multiple clients could be attempting to delete workers at the same time. Pass db_id as `actor_id` parameter. """ logger.debug("top of delete_worker().") try: wk = workers_store.pop_field(actor_id, worker_id) logger.info("worker deleted. actor: {}. worker: {}.".format(actor_id, worker_id)) except KeyError as e: logger.info("KeyError deleting worker. actor: {}. worker: {}. exception: {}".format(actor_id, worker_id, e)) raise errors.WorkerException("Worker not found.")
def get_worker(cls, actor_id, worker_id): """Retrieve a worker from the workers store. Pass db_id as `actor_id` parameter.""" try: return workers_store[actor_id][worker_id] except KeyError: raise errors.WorkerException("Worker not found.")