def set_job_params(self, pipeline): """ Sets dumped job params to Redis key """ key = self.get_job_params_key() value = (self.keys, self.decrement) pipeline.set(key, dumps(value))
def merge_job_params(self, keys, decrement, pipeline): """ Merges job parameters to allow to skip one of these jobs """ key = self.get_job_params_key() data = self.connection.get(key) old_keys, old_decrement = loads(data) new_params = (keys | old_keys, decrement + old_decrement) pipeline.set(key, dumps(new_params)) return new_params