Skip to content

Commit

Permalink
if unset, set PYTHONHASHSEED in pre_spawn_env
Browse files Browse the repository at this point in the history
  • Loading branch information
cisaacstern committed Dec 12, 2023
1 parent d249170 commit 6f2b004
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions distributed/nanny.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,13 @@ def __init__( # type: ignore[no-untyped-def]
self.Worker = Worker if worker_class is None else worker_class

self.pre_spawn_env = _get_env_variables("distributed.nanny.pre-spawn-environ")
# To get consistent hashing on subprocesses, we need to set a consistent seed for
# the Python hash algorithm; xref https://github.com/dask/distributed/pull/8400
if self.pre_spawn_env.get("PYTHONHASHSEED") in (None, "0"):
# This number is arbitrary; it was chosen to commemorate
# https://github.com/dask/dask/issues/6640.
self.pre_spawn_env.update({"PYTHONHASHSEED": "6640"})

self.env = merge(
self.pre_spawn_env,
_get_env_variables("distributed.nanny.environ"),
Expand Down

0 comments on commit 6f2b004

Please sign in to comment.