From c679c1af2f86adf6cf966582d743723fe2152e3d Mon Sep 17 00:00:00 2001 From: Thomas Matecki Date: Tue, 14 Apr 2020 22:06:00 -0400 Subject: [PATCH] Change parameter name from `exclude` ... ...to `exclude_job_id`. Also make it a single id not a set. --- rq/job.py | 11 +++-------- rq/queue.py | 4 ++-- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/rq/job.py b/rq/job.py index 6ae0633..978532a 100644 --- a/rq/job.py +++ b/rq/job.py @@ -9,6 +9,7 @@ from functools import partial from uuid import uuid4 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 @@ -740,12 +741,7 @@ class Job(object): return [Job.key_for(as_text(_id)) for _id in dependencies] - def dependencies_are_met( - self, - pipeline=None, - exclude=None - - ): + def dependencies_are_met(self, exclude_job_id=None, pipeline=None): """Returns a boolean indicating if all of this jobs dependencies are _FINISHED_ If a pipeline is passed, all dependencies are WATCHed. @@ -755,7 +751,6 @@ class Job(object): `FINISHED` may not be yet set in redis, but said job is indeed _done_ and this method is _called_ in the _stack_ of it's dependents are being enqueued. """ - exclude = exclude or [] pipe = pipeline if pipeline is not None else self.connection @@ -786,6 +781,6 @@ class Job(object): return all(status == JobStatus.FINISHED or not created_at for dependency_id, created_at, status in dependencies_statuses - if dependency_id not in exclude) + if not (exclude_job_id and dependency_id == exclude_job_id)) _job_stack = LocalStack() diff --git a/rq/queue.py b/rq/queue.py index 6a0ed05..c545f43 100644 --- a/rq/queue.py +++ b/rq/queue.py @@ -469,8 +469,8 @@ class Queue(object): dependent_job_ids, connection=self.connection ) if dependent_job.dependencies_are_met( - pipeline=pipe, - exclude={job.id} + exclude_job_id=job.id, + pipeline=pipe ) ]