Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add global variable to Scheduler on compiled state #2

Merged
merged 2 commits into from
Apr 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions distributed/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ def nogil(func):
set, {"released", "waiting", "no-worker", "processing", "erred", "memory"}
)
globals()["ALL_TASK_STATES"] = ALL_TASK_STATES
COMPILED = declare(
bint, compiled
)
globals()["COMPILED"] = COMPILED


@final
Expand Down
11 changes: 2 additions & 9 deletions distributed/tests/test_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from distributed.core import ConnectionPool, Status, connect, rpc
from distributed.metrics import time
from distributed.protocol.pickle import dumps
from distributed.scheduler import MemoryState, Scheduler
from distributed.scheduler import COMPILED, MemoryState, Scheduler
from distributed.utils import TimeoutError, tmpfile, typename
from distributed.utils_test import ( # noqa: F401
captured_logger,
Expand Down Expand Up @@ -72,14 +72,7 @@ def test_cythonized():
# cythonized as expected
import distributed.scheduler

if strtobool(os.environ["CYTHONIZED"]):
expected_suffix = ".pyd" if WINDOWS else ".so"
else:
expected_suffix = ".py"

assert distributed.scheduler.__file__.endswith(
expected_suffix
), distributed.scheduler
assert strtobool(os.environ["CYTHONIZED"]) == COMPILED


@gen_cluster()
Expand Down