Change parameter name from `exclude` ...

...to `exclude_job_id`. Also make it a single id not a set.
main
Thomas Matecki 5 years ago
parent c0119a8a19
commit c679c1af2f

@ -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()

@ -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
)
]

Loading…
Cancel
Save