Skip to content

Commit

Permalink
Merge branch 'main' into memorysampler
Browse files Browse the repository at this point in the history
  • Loading branch information
crusaderky committed Aug 31, 2022
2 parents dcf619c + a5d6865 commit 5ba67bc
Show file tree
Hide file tree
Showing 23 changed files with 1,418 additions and 434 deletions.
19 changes: 15 additions & 4 deletions .github/workflows/test-report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ jobs:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ github.token }}
PYTHON_VERSION: 3.9
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v2

Expand All @@ -24,20 +28,27 @@ jobs:
miniforge-version: latest
condarc-file: continuous_integration/condarc
use-mamba: true
python-version: 3.9
python-version: ${{ env.PYTHON_VERSION }}
environment-file: continuous_integration/scripts/test-report-environment.yml
activate-environment: dask-distributed

- name: Show conda options
shell: bash -l {0}
run: conda config --show

- name: mamba list
shell: bash -l {0}
run: mamba list

- uses: actions/cache@v3
id: cache
with:
# Suffix is depending on the backend / OS. Let's be agnostic here
# See https://docs.python.org/3/library/shelve.html#shelve.open
path: |
test_report*
!test_report.html
key: ${{ env.PYTHON_VERSION }}-${{ hashFiles('continuous_integration/scripts/test_report*') }}

- name: Generate report
shell: bash -l {0}
run: |
python continuous_integration/scripts/test_report.py --max-days 90 --max-runs 50 --nfails 1 -o test_report.html
python continuous_integration/scripts/test_report.py --max-days 7 --max-runs 50 --nfails 2 -o test_short_report.html --title "Test Short Report"
Expand Down
38 changes: 29 additions & 9 deletions distributed/dashboard/components/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2162,8 +2162,8 @@ def __init__(self, scheduler, **kwargs):

node_colors = factor_cmap(
"state",
factors=["waiting", "processing", "memory", "released", "erred"],
palette=["gray", "green", "red", "blue", "black"],
factors=["waiting", "queued", "processing", "memory", "released", "erred"],
palette=["gray", "yellow", "green", "red", "blue", "black"],
)

self.root = figure(title="Task Graph", **kwargs)
Expand Down Expand Up @@ -3051,7 +3051,7 @@ def __init__(self, scheduler, **kwargs):
self.scheduler = scheduler

data = progress_quads(
dict(all={}, memory={}, erred={}, released={}, processing={})
dict(all={}, memory={}, erred={}, released={}, processing={}, queued={})
)
self.source = ColumnDataSource(data=data)

Expand Down Expand Up @@ -3123,6 +3123,18 @@ def __init__(self, scheduler, **kwargs):
fill_alpha=0.35,
line_alpha=0,
)
self.root.quad(
source=self.source,
top="top",
bottom="bottom",
left="processing-loc",
right="queued-loc",
fill_color="gray",
hatch_pattern="/",
hatch_color="white",
fill_alpha=0.35,
line_alpha=0,
)
self.root.text(
source=self.source,
text="show-name",
Expand Down Expand Up @@ -3158,6 +3170,14 @@ def __init__(self, scheduler, **kwargs):
<span style="font-size: 14px; font-weight: bold;">All:</span>&nbsp;
<span style="font-size: 10px; font-family: Monaco, monospace;">@all</span>
</div>
<div>
<span style="font-size: 14px; font-weight: bold;">Queued:</span>&nbsp;
<span style="font-size: 10px; font-family: Monaco, monospace;">@queued</span>
</div>
<div>
<span style="font-size: 14px; font-weight: bold;">Processing:</span>&nbsp;
<span style="font-size: 10px; font-family: Monaco, monospace;">@processing</span>
</div>
<div>
<span style="font-size: 14px; font-weight: bold;">Memory:</span>&nbsp;
<span style="font-size: 10px; font-family: Monaco, monospace;">@memory</span>
Expand All @@ -3166,10 +3186,6 @@ def __init__(self, scheduler, **kwargs):
<span style="font-size: 14px; font-weight: bold;">Erred:</span>&nbsp;
<span style="font-size: 10px; font-family: Monaco, monospace;">@erred</span>
</div>
<div>
<span style="font-size: 14px; font-weight: bold;">Ready:</span>&nbsp;
<span style="font-size: 10px; font-family: Monaco, monospace;">@processing</span>
</div>
""",
)
self.root.add_tools(hover)
Expand All @@ -3183,6 +3199,7 @@ def update(self):
"released": {},
"processing": {},
"waiting": {},
"queued": {},
}

for tp in self.scheduler.task_prefixes.values():
Expand All @@ -3193,6 +3210,7 @@ def update(self):
state["released"][tp.name] = active_states["released"]
state["processing"][tp.name] = active_states["processing"]
state["waiting"][tp.name] = active_states["waiting"]
state["queued"][tp.name] = active_states["queued"]

state["all"] = {k: sum(v[k] for v in state.values()) for k in state["memory"]}

Expand All @@ -3205,16 +3223,18 @@ def update(self):

totals = {
k: sum(state[k].values())
for k in ["all", "memory", "erred", "released", "waiting"]
for k in ["all", "memory", "erred", "released", "waiting", "queued"]
}
totals["processing"] = totals["all"] - sum(
v for k, v in totals.items() if k != "all"
)

self.root.title.text = (
"Progress -- total: %(all)s, "
"in-memory: %(memory)s, processing: %(processing)s, "
"waiting: %(waiting)s, "
"queued: %(queued)s, "
"processing: %(processing)s, "
"in-memory: %(memory)s, "
"erred: %(erred)s" % totals
)

Expand Down
51 changes: 33 additions & 18 deletions distributed/diagnostics/progress_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def counts(scheduler, allprogress):
{"all": valmap(len, allprogress.all), "nbytes": allprogress.nbytes},
{
state: valmap(len, allprogress.state[state])
for state in ["memory", "erred", "released", "processing"]
for state in ["memory", "erred", "released", "processing", "queued"]
},
)

Expand Down Expand Up @@ -66,23 +66,29 @@ def progress_quads(msg, nrows=8, ncols=3):
... 'memory': {'inc': 2, 'dec': 0, 'add': 1},
... 'erred': {'inc': 0, 'dec': 1, 'add': 0},
... 'released': {'inc': 1, 'dec': 0, 'add': 1},
... 'processing': {'inc': 1, 'dec': 0, 'add': 2}}
... 'processing': {'inc': 1, 'dec': 0, 'add': 2},
... 'queued': {'inc': 1, 'dec': 0, 'add': 2}}
>>> progress_quads(msg, nrows=2) # doctest: +SKIP
{'name': ['inc', 'add', 'dec'],
'left': [0, 0, 1],
'right': [0.9, 0.9, 1.9],
'top': [0, -1, 0],
'bottom': [-.8, -1.8, -.8],
'released': [1, 1, 0],
'memory': [2, 1, 0],
'erred': [0, 0, 1],
'processing': [1, 0, 2],
'done': ['3 / 5', '2 / 4', '1 / 1'],
'released-loc': [.2/.9, .25 / 0.9, 1],
'memory-loc': [3 / 5 / .9, .5 / 0.9, 1],
'erred-loc': [3 / 5 / .9, .5 / 0.9, 1.9],
'processing-loc': [4 / 5, 1 / 1, 1]}}
{'all': [5, 4, 1],
'memory': [2, 1, 0],
'erred': [0, 0, 1],
'released': [1, 1, 0],
'processing': [1, 2, 0],
'queued': [1, 2, 0],
'name': ['inc', 'add', 'dec'],
'show-name': ['inc', 'add', 'dec'],
'left': [0, 0, 1],
'right': [0.9, 0.9, 1.9],
'top': [0, -1, 0],
'bottom': [-0.8, -1.8, -0.8],
'color': ['#45BF6F', '#2E6C8E', '#440154'],
'released-loc': [0.18, 0.225, 1.0],
'memory-loc': [0.54, 0.45, 1.0],
'erred-loc': [0.54, 0.45, 1.9],
'processing-loc': [0.72, 0.9, 1.9],
'queued-loc': [0.9, 1.35, 1.9],
'done': ['3 / 5', '2 / 4', '1 / 1']}
"""
width = 0.9
names = sorted(msg["all"], key=msg["all"].get, reverse=True)
Expand All @@ -102,19 +108,28 @@ def progress_quads(msg, nrows=8, ncols=3):
d["memory-loc"] = []
d["erred-loc"] = []
d["processing-loc"] = []
d["queued-loc"] = []
d["done"] = []
for r, m, e, p, a, l in zip(
d["released"], d["memory"], d["erred"], d["processing"], d["all"], d["left"]
for r, m, e, p, q, a, l in zip(
d["released"],
d["memory"],
d["erred"],
d["processing"],
d["queued"],
d["all"],
d["left"],
):
rl = width * r / a + l
ml = width * (r + m) / a + l
el = width * (r + m + e) / a + l
pl = width * (p + r + m + e) / a + l
ql = width * (p + r + m + e + q) / a + l
done = "%d / %d" % (r + m + e, a)
d["released-loc"].append(rl)
d["memory-loc"].append(ml)
d["erred-loc"].append(el)
d["processing-loc"].append(pl)
d["queued-loc"].append(ql)
d["done"].append(done)

return d
Expand Down
6 changes: 6 additions & 0 deletions distributed/diagnostics/tests/test_progress_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def test_progress_quads():
"erred": {"inc": 0, "dec": 1, "add": 0},
"released": {"inc": 1, "dec": 0, "add": 1},
"processing": {"inc": 1, "dec": 0, "add": 2},
"queued": {"inc": 1, "dec": 0, "add": 2},
}

d = progress_quads(msg, nrows=2)
Expand All @@ -35,11 +36,13 @@ def test_progress_quads():
"memory": [2, 1, 0],
"erred": [0, 0, 1],
"processing": [1, 2, 0],
"queued": [1, 2, 0],
"done": ["3 / 5", "2 / 4", "1 / 1"],
"released-loc": [0.9 * 1 / 5, 0.25 * 0.9, 1.0],
"memory-loc": [0.9 * 3 / 5, 0.5 * 0.9, 1.0],
"erred-loc": [0.9 * 3 / 5, 0.5 * 0.9, 1.9],
"processing-loc": [0.9 * 4 / 5, 1 * 0.9, 1 * 0.9 + 1],
"queued-loc": [1 * 0.9, 1.5 * 0.9, 1 * 0.9 + 1],
}
assert d == expected

Expand All @@ -52,6 +55,7 @@ def test_progress_quads_too_many():
"erred": {k: 0 for k in keys},
"released": {k: 0 for k in keys},
"processing": {k: 0 for k in keys},
"queued": {k: 0 for k in keys},
}

d = progress_quads(msg, nrows=6, ncols=3)
Expand All @@ -78,6 +82,7 @@ async def test_progress_stream(c, s, a, b):
"memory": {"div": 9, "inc": 1},
"released": {"inc": 4},
"processing": {},
"queued": {},
}
assert set(nbytes) == set(msg["all"])
assert all(v > 0 for v in nbytes.values())
Expand All @@ -95,6 +100,7 @@ def test_progress_quads_many_functions():
"erred": {fn: 0 for fn in funcnames},
"released": {fn: 0 for fn in funcnames},
"processing": {fn: 0 for fn in funcnames},
"queued": {fn: 0 for fn in funcnames},
}

d = progress_quads(msg, nrows=2)
Expand Down
Loading

0 comments on commit 5ba67bc

Please sign in to comment.