Skip to content

Commit

Permalink
Fix regressions
Browse files Browse the repository at this point in the history
  • Loading branch information
crusaderky committed Oct 20, 2022
1 parent 998de6c commit 0850804
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 7 deletions.
24 changes: 21 additions & 3 deletions distributed/http/worker/tests/test_worker_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,14 @@ async def fetch_state_metrics():
assert not a.state.tasks
active_metrics = await fetch_state_metrics()
assert active_metrics == {
"stored": 0.0,
"constrained": 0.0,
"executing": 0.0,
"fetch": 0.0,
"flight": 0.0,
"long-running": 0.0,
"memory": 0.0,
"missing": 0.0,
"other": 0.0,
"ready": 0.0,
"waiting": 0.0,
}
Expand All @@ -86,8 +92,14 @@ async def fetch_state_metrics():

active_metrics = await fetch_state_metrics()
assert active_metrics == {
"stored": 0.0,
"constrained": 0.0,
"executing": 1.0,
"fetch": 0.0,
"flight": 0.0,
"long-running": 0.0,
"memory": 0.0,
"missing": 0.0,
"other": 0.0,
"ready": 0.0,
"waiting": 0.0,
}
Expand All @@ -102,8 +114,14 @@ async def fetch_state_metrics():

active_metrics = await fetch_state_metrics()
assert active_metrics == {
"stored": 0.0,
"constrained": 0.0,
"executing": 0.0,
"fetch": 0.0,
"flight": 0.0,
"long-running": 0.0,
"memory": 0.0,
"missing": 0.0,
"other": 0.0,
"ready": 0.0,
"waiting": 0.0,
}
Expand Down
3 changes: 1 addition & 2 deletions distributed/tests/test_worker_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -703,10 +703,9 @@ async def test_override_data_worker(s):
async with Worker(s.address, data=UserDict) as w:
assert type(w.data) is UserDict

data = UserDict({"x": 1})
data = UserDict()
async with Worker(s.address, data=data) as w:
assert w.data is data
assert w.data == {"x": 1}


@gen_cluster(
Expand Down
34 changes: 32 additions & 2 deletions distributed/tests/test_worker_state_machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -1676,8 +1676,24 @@ def test_fetch_count(ws):
assert len(ws.missing_dep_flight) == 1


def test_task_counts(ws_with_running_task):
ws = ws_with_running_task
def test_task_counts(ws):
assert ws.task_counts == {
"constrained": 0,
"executing": 0,
"fetch": 0,
"flight": 0,
"long-running": 0,
"memory": 0,
"missing": 0,
"other": 0,
"ready": 0,
"waiting": 0,
}


def test_task_counts_actor_in_memory(ws):
ws.handle_stimulus(ComputeTaskEvent.dummy("x", actor=True, stimulus_id="s1"))
assert ws.actors == {"x": None}
assert ws.task_counts == {
"constrained": 0,
"executing": 1,
Expand All @@ -1690,3 +1706,17 @@ def test_task_counts(ws_with_running_task):
"ready": 0,
"waiting": 0,
}
ws.handle_stimulus(ExecuteSuccessEvent.dummy("x", value=123, stimulus_id="s2"))
assert ws.actors == {"x": 123}
assert ws.task_counts == {
"constrained": 0,
"executing": 0,
"fetch": 0,
"flight": 0,
"long-running": 0,
"memory": 1,
"missing": 0,
"other": 0,
"ready": 0,
"waiting": 0,
}

0 comments on commit 0850804

Please sign in to comment.