Skip to content
This repository has been archived by the owner on Feb 10, 2021. It is now read-only.

Allow starting and stopping no workers #68

Merged
merged 4 commits into from
Apr 1, 2018

Conversation

jakirkham
Copy link
Member

@jakirkham jakirkham commented Apr 1, 2018

Makes sure that start_workers can take n = 0 and stop_workers can take worker_ids = []. Namely by not starting or stopping any workers. Previously these errored out in a cryptic way. So by simply avoiding erroring out, this is an improvement.

Previously if `start_workers` was given `n = 0`, it would crash in a
cryptic way. This fixes that issue by simply skipping starting any
workers if `n = 0`.
@@ -198,6 +198,9 @@ def create_job_template(self, **kwargs):
return jt

def start_workers(self, n=1, **kwargs):
if n == 0:
return
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: Might be worth adding a warning as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May revisit this later. For now will leave the warning out.

Previously if `stop_workers` was given `worker_ids = []`, it would crash
in a cryptic way. This fixes that issue by simply skipping stopping any
workers if `worker_ids = []`.
Now that `stop_workers` guards against closing workers if none are
provided, simply always call `stop_workers` in `close`.
@jakirkham jakirkham force-pushed the allow_starting_zero_workers branch from 3bbfc14 to c0fd68d Compare April 1, 2018 21:26
@jakirkham jakirkham changed the title Allow starting zero workers Allow starting and stopping no workers Apr 1, 2018
Add a test to ensure that `start_workers` can be passed `n = 0` without
issues. Also ensure this translates into no workers being added. Further
test that `stop_workers` can be called with an empty list.
@jakirkham jakirkham force-pushed the allow_starting_zero_workers branch from c0fd68d to 62b03c0 Compare April 1, 2018 21:29
@jakirkham jakirkham merged commit c0f3367 into dask:master Apr 1, 2018
@jakirkham jakirkham deleted the allow_starting_zero_workers branch April 1, 2018 21:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant