rename dependencies_finished to dependencies_are_met

main
thomas 5 years ago committed by Thomas Matecki
parent d5921814e4
commit 9f15df2d55

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

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

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

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

Loading…
Cancel
Save