diff --git a/rq/job.py b/rq/job.py index 810e1f6..cf8948e 100644 --- a/rq/job.py +++ b/rq/job.py @@ -724,7 +724,7 @@ class Job(object): connection.sadd(dependents_key, self.id) connection.sadd(self.dependencies_key, dependency_id) - def dependencies_finished( + def dependencies_are_met( self, pipeline=None ): diff --git a/rq/queue.py b/rq/queue.py index afe7f48..4fe1b44 100644 --- a/rq/queue.py +++ b/rq/queue.py @@ -467,7 +467,7 @@ class Queue(object): dependent_jobs = [ job for job in self.job_class.fetch_many(dependent_job_ids, connection=self.connection) - if job.dependencies_finished(pipeline=pipe) + if job.dependencies_are_met(pipeline=pipe) ] pipe.multi() diff --git a/rq/worker.py b/rq/worker.py index 8678ad3..5161a24 100644 --- a/rq/worker.py +++ b/rq/worker.py @@ -845,6 +845,7 @@ class Worker(object): # if dependencies are inserted after enqueue_dependents # a WatchError is thrown by execute() pipeline.watch(job.dependents_key) + # TODO: This was moved job.set_status(JobStatus.FINISHED, pipeline=pipeline) # enqueue_dependents calls multi() on the pipeline! queue.enqueue_dependents(job, pipeline=pipeline) diff --git a/tests/test_job.py b/tests/test_job.py index 394140a..6ce717e 100644 --- a/tests/test_job.py +++ b/tests/test_job.py @@ -810,7 +810,7 @@ class TestJob(RQTestCase): dependent_job._dependency_ids = dependency_job_ids dependent_job.register_dependency() - dependencies_finished = dependent_job.dependencies_finished() + dependencies_finished = dependent_job.dependencies_are_met() self.assertFalse(dependencies_finished) @@ -820,7 +820,7 @@ class TestJob(RQTestCase): dependent_job = Job.create(func=fixtures.say_hello) dependent_job.register_dependency() - dependencies_finished = dependent_job.dependencies_finished() + dependencies_finished = dependent_job.dependencies_are_met() self.assertTrue(dependencies_finished) @@ -842,7 +842,7 @@ class TestJob(RQTestCase): job.ended_at = now - timedelta(seconds=i) job.save() - dependencies_finished = dependent_job.dependencies_finished() + dependencies_finished = dependent_job.dependencies_are_met() self.assertTrue(dependencies_finished) @@ -863,7 +863,7 @@ class TestJob(RQTestCase): now = utcnow() - dependencies_finished = dependent_job.dependencies_finished() + dependencies_finished = dependent_job.dependencies_are_met() self.assertFalse(dependencies_finished) @@ -878,7 +878,7 @@ class TestJob(RQTestCase): with self.testconn.pipeline() as pipeline: - dependent_job.dependencies_finished( + dependent_job.dependencies_are_met( pipeline=pipeline, )