From 0672cd00c6ab5268f83887e66990726904cbe1f9 Mon Sep 17 00:00:00 2001 From: Thomas Matecki Date: Thu, 16 Apr 2020 23:13:06 -0400 Subject: [PATCH] Revisions * Rename `dependent_jobs` to `jobs_to_enqueue` in queue.py * Rename `dependencies_job_ids` to `dependency_ids`. * Remove `as_text` (no more python2 support). Use `bytes.decode` --- rq/job.py | 8 ++++---- rq/queue.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/rq/job.py b/rq/job.py index 978532a..51b76d8 100644 --- a/rq/job.py +++ b/rq/job.py @@ -13,9 +13,9 @@ from rq.compat import as_text, decode_redis_hash, string_types, text_type from .connections import resolve_connection from .exceptions import NoSuchJobError from .local import LocalStack +from .serializers import resolve_serializer from .utils import (enum, import_attribute, parse_timeout, str_to_date, utcformat, utcnow) -from .serializers import resolve_serializer try: import cPickle as pickle @@ -736,9 +736,9 @@ class Job(object): connection.sadd(self.dependencies_key, dependency_id) @property - def dependencies_job_ids(self): + def dependency_ids(self): dependencies = self.connection.smembers(self.dependencies_key) - return [Job.key_for(as_text(_id)) + return [Job.key_for(_id.decode()) for _id in dependencies] def dependencies_are_met(self, exclude_job_id=None, pipeline=None): @@ -755,7 +755,7 @@ class Job(object): pipe = pipeline if pipeline is not None else self.connection if pipeline is not None: - pipe.watch(*self.dependencies_job_ids) + pipe.watch(*self.dependency_ids) sort_by = self.redis_job_namespace_prefix + '*->ended_at' get_fields = ( diff --git a/rq/queue.py b/rq/queue.py index c545f43..297d5e2 100644 --- a/rq/queue.py +++ b/rq/queue.py @@ -463,7 +463,7 @@ class Queue(object): dependent_job_ids = [as_text(_id) for _id in pipe.smembers(dependents_key)] - dependent_jobs = [ + jobs_to_enqueue = [ dependent_job for dependent_job in self.job_class.fetch_many( dependent_job_ids, @@ -476,7 +476,7 @@ class Queue(object): pipe.multi() - for dependent in dependent_jobs: + for dependent in jobs_to_enqueue: registry = DeferredJobRegistry(dependent.origin, self.connection, job_class=self.job_class)