Skip to content

Commit ae2e67d

Browse files
Merge branch 'main' into tau-effective-power-sample
2 parents 8d5a52d + 79f3d3a commit ae2e67d

43 files changed

Lines changed: 1274 additions & 565 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
import csv
2+
from pathlib import Path
3+
4+
import matplotlib.pyplot as plt
5+
6+
root = Path("memory_artifacts")
7+
files = list(root.glob("**/memory_usage.csv"))
8+
9+
groups = {
10+
"integration": [],
11+
"unit": [],
12+
"windows": [],
13+
}
14+
15+
linestyles = {
16+
"3.11": "-",
17+
"3.12": "--",
18+
"3.13": ":",
19+
}
20+
21+
colors = {
22+
"integration": "orange",
23+
"unit": "brown",
24+
"windows": "purple",
25+
}
26+
27+
28+
def parse_label(name: str):
29+
label = name.replace("memory-", "")
30+
31+
if label.startswith("integration-"):
32+
group = "integration"
33+
pyver = label.split("-")[1]
34+
elif label.startswith("unit-"):
35+
group = "unit"
36+
pyver = label.split("-")[1]
37+
elif label.startswith("windows-"):
38+
group = "windows"
39+
pyver = label.split("-")[1]
40+
else:
41+
return None, None
42+
43+
return group, pyver
44+
45+
46+
all_x = []
47+
48+
for f in sorted(files):
49+
label = f.parent.name
50+
group, pyver = parse_label(label)
51+
if group is None:
52+
continue
53+
54+
times = []
55+
used = []
56+
57+
with f.open() as fh:
58+
reader = csv.DictReader(fh)
59+
t0 = None
60+
for row in reader:
61+
t = float(row["timestamp"])
62+
if t0 is None:
63+
t0 = t
64+
times.append((t - t0) / 60.0)
65+
used.append(float(row["mem_used_mb"]))
66+
67+
if times:
68+
all_x.extend(times)
69+
groups[group].append((pyver, times, used))
70+
71+
xmax = max(all_x) if all_x else 1
72+
73+
fig, axes = plt.subplots(3, 1, figsize=(12, 10), sharex=True)
74+
75+
subplot_order = [
76+
("integration", "Ubuntu integration"),
77+
("unit", "Ubuntu unit"),
78+
("windows", "Windows"),
79+
]
80+
81+
for ax, (group, title) in zip(axes, subplot_order):
82+
for pyver, times, used in sorted(groups[group], key=lambda x: x[0]):
83+
ax.plot(
84+
times,
85+
used,
86+
label=pyver,
87+
color=colors[group],
88+
linestyle=linestyles.get(pyver, "-"),
89+
linewidth=2,
90+
)
91+
92+
ax.set_title(title)
93+
ax.set_ylabel("RAM used (MB)")
94+
ax.set_xlim(0, xmax)
95+
ax.legend(title="Python")
96+
97+
axes[-1].set_xlabel("Time since job start (minutes)")
98+
99+
fig.suptitle("CI memory usage by job", fontsize=16)
100+
fig.tight_layout()
101+
fig.savefig("memory_all_jobs.png", dpi=150)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
3+
mkdir -p ci_monitor
4+
echo "timestamp,mem_used_mb" > ci_monitor/memory_usage.csv
5+
6+
while true; do
7+
ts=$(date +%s)
8+
used=$(free -m | awk '/^Mem:/ {print $3}')
9+
echo "$ts,$used" >> ci_monitor/memory_usage.csv
10+
sleep 5
11+
done
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
New-Item -ItemType Directory -Force -Path ci_monitor | Out-Null
2+
"timestamp,mem_used_mb" | Out-File ci_monitor/memory_usage.csv -Encoding ascii
3+
4+
while ($true) {
5+
$ts = [DateTimeOffset]::UtcNow.ToUnixTimeSeconds()
6+
7+
$os = Get-CimInstance Win32_OperatingSystem
8+
$total = $os.TotalVisibleMemorySize / 1024
9+
$free = $os.FreePhysicalMemory / 1024
10+
$used = [math]::Round($total - $free, 2)
11+
12+
"$ts,$used" | Out-File ci_monitor/memory_usage.csv -Append -Encoding ascii
13+
14+
Start-Sleep -Seconds 5
15+
}

.github/workflows/build.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
--cov=echopype --cov-report=xml --log-cli-level=WARNING --disable-warnings
6161
6262
- name: Upload code coverage to Codecov
63-
uses: codecov/codecov-action@v5
63+
uses: codecov/codecov-action@v6
6464
with:
6565
files: ./coverage.xml
6666
flags: unit
@@ -205,7 +205,7 @@ jobs:
205205
--cov=echopype --cov-report=xml --log-cli-level=WARNING --disable-warnings
206206
207207
- name: Upload code coverage to Codecov
208-
uses: codecov/codecov-action@v5
208+
uses: codecov/codecov-action@v6
209209
with:
210210
files: ./coverage.xml
211211
flags: integration

.github/workflows/docker.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
uses: docker/setup-qemu-action@v4
5555

5656
- name: Set up Docker Buildx
57-
uses: docker/setup-buildx-action@v3
57+
uses: docker/setup-buildx-action@v4
5858

5959
- name: Login to DockerHub
6060
uses: docker/login-action@v4

.github/workflows/pr.yaml

Lines changed: 96 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,35 @@ jobs:
5959
- name: Install pooch (needed by conftest)
6060
run: python -m pip install pooch
6161

62+
- name: Start memory monitor
63+
shell: bash
64+
run: |
65+
mkdir -p ci_monitor
66+
nohup bash .ci_helpers/memory_usage/monitor_memory_linux.sh >/dev/null 2>&1 &
67+
echo $! > ci_monitor/monitor.pid
68+
6269
- name: Run unit tests
6370
run: |
6471
pytest -m unit -vvv -rx --numprocesses=auto \
6572
--cov=echopype --cov-report=xml --log-cli-level=WARNING --disable-warnings
6673
74+
- name: Stop memory monitor
75+
if: always()
76+
shell: bash
77+
run: |
78+
if [ -f ci_monitor/monitor.pid ]; then
79+
kill "$(cat ci_monitor/monitor.pid)" || true
80+
fi
81+
82+
- name: Upload memory CSV
83+
if: always()
84+
uses: actions/upload-artifact@v7
85+
with:
86+
name: memory-unit-${{ matrix.python-version }}-${{ matrix.runs-on }}
87+
path: ci_monitor/memory_usage.csv
88+
6789
- name: Upload code coverage to Codecov
68-
uses: codecov/codecov-action@v5
90+
uses: codecov/codecov-action@v6
6991
with:
7092
files: ./coverage.xml
7193
flags: unit
@@ -191,13 +213,35 @@ jobs:
191213
du -h -d 3 ${{ env.XDG_CACHE_HOME }} || true
192214
docker system df || true
193215
216+
- name: Start memory monitor
217+
shell: bash
218+
run: |
219+
mkdir -p ci_monitor
220+
nohup bash .ci_helpers/memory_usage/monitor_memory_linux.sh >/dev/null 2>&1 &
221+
echo $! > ci_monitor/monitor.pid
222+
194223
- name: Running integration tests
195224
run: |
196225
pytest -m integration -vvv -rx --numprocesses=${{ env.NUM_WORKERS }} --max-worker-restart=3 \
197226
--cov=echopype --cov-report=xml --log-cli-level=WARNING --disable-warnings
198227
228+
- name: Stop memory monitor
229+
if: always()
230+
shell: bash
231+
run: |
232+
if [ -f ci_monitor/monitor.pid ]; then
233+
kill "$(cat ci_monitor/monitor.pid)" || true
234+
fi
235+
236+
- name: Upload memory CSV
237+
if: always()
238+
uses: actions/upload-artifact@v7
239+
with:
240+
name: memory-integration-${{ matrix.python-version }}-${{ matrix.runs-on }}
241+
path: ci_monitor/memory_usage.csv
242+
199243
- name: Upload code coverage to Codecov
200-
uses: codecov/codecov-action@v5
244+
uses: codecov/codecov-action@v6
201245
with:
202246
files: ./coverage.xml
203247
flags: integration
@@ -245,6 +289,13 @@ jobs:
245289
- name: Start local services
246290
run: python .ci_helpers/setup-services-windows.py start
247291

292+
- name: Start memory monitor
293+
shell: pwsh
294+
run: |
295+
New-Item -ItemType Directory -Force -Path ci_monitor | Out-Null
296+
$p = Start-Process pwsh -ArgumentList "-File", ".ci_helpers/memory_usage/monitor_memory_windows.ps1" -PassThru -WindowStyle Hidden
297+
$p.Id | Out-File ci_monitor/monitor.pid -Encoding ascii
298+
248299
- name: Running all tests
249300
shell: pwsh
250301
env:
@@ -255,8 +306,24 @@ jobs:
255306
--cov echopype --cov-report xml
256307
--log-cli-level WARNING --disable-warnings
257308
309+
- name: Stop memory monitor
310+
if: always()
311+
shell: pwsh
312+
run: |
313+
if (Test-Path ci_monitor/monitor.pid) {
314+
$monitorPid = Get-Content ci_monitor/monitor.pid
315+
Stop-Process -Id $monitorPid -Force -ErrorAction SilentlyContinue
316+
}
317+
318+
- name: Upload memory CSV
319+
if: always()
320+
uses: actions/upload-artifact@v7
321+
with:
322+
name: memory-windows-${{ matrix.python-version }}
323+
path: ci_monitor/memory_usage.csv
324+
258325
- name: Upload code coverage
259-
uses: codecov/codecov-action@v5
326+
uses: codecov/codecov-action@v6
260327
with:
261328
files: ./coverage.xml
262329
flags: unittests
@@ -267,3 +334,29 @@ jobs:
267334
- name: Teardown services
268335
if: always()
269336
run: python .ci_helpers/setup-services-windows.py stop
337+
338+
memory-summary:
339+
name: memory-summary
340+
runs-on: ubuntu-latest
341+
needs: [unit-tests, integration-tests, test-windows]
342+
if: always()
343+
344+
steps:
345+
- uses: actions/checkout@v6
346+
347+
- name: Download all memory artifacts
348+
uses: actions/download-artifact@v8
349+
with:
350+
path: memory_artifacts
351+
352+
- name: Install matplotlib
353+
run: python -m pip install matplotlib
354+
355+
- name: Build memory summary
356+
run: python .ci_helpers/memory_usage/build_memory_summary.py
357+
358+
- name: Upload combined memory plot
359+
uses: actions/upload-artifact@v7
360+
with:
361+
name: memory-summary
362+
path: memory_all_jobs.png

.github/workflows/pypi.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ jobs:
2828
with:
2929
python-version: 3.12
3030

31-
- name: Install dependencies
32-
run: python -m pip install setuptools wheel
31+
- name: Install build frontend
32+
run: python -m pip install --upgrade pip build
3333

3434
# This step is only necessary for testing purposes and for TestPyPI
3535
- name: Fix up version string for TestPyPI
@@ -42,7 +42,7 @@ jobs:
4242
4343
- name: Build source and wheel distributions
4444
run: |
45-
python setup.py sdist bdist_wheel
45+
python -m build
4646
echo ""
4747
echo "Generated files:"
4848
ls -lh dist/

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ repos:
2424
args: ["--profile", "black", "--filter-files"]
2525

2626
- repo: https://github.com/psf/black-pre-commit-mirror
27-
rev: 26.3.0
27+
rev: 26.3.1
2828
hooks:
2929
- id: black
3030

.readthedocs.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ build:
1919
sphinx:
2020
configuration: docs/source/conf.py
2121

22-
# Build documentation with MkDocs
23-
#mkdocs:
24-
# configuration: mkdocs.yml
25-
2622
# Optionally build your docs in additional formats such as PDF and ePub
2723
formats: []
2824

@@ -34,6 +30,3 @@ python:
3430
path: .
3531
extra_requirements:
3632
- plot
37-
- method: setuptools
38-
path: .
39-
# system_packages: true

MANIFEST.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,4 @@ include *.txt
1313
# Ignore testing files and data
1414
prune echopype/test_data
1515
prune echopype/tests
16-
exclude echopype/testing.py
1716
exclude .gitattributes

0 commit comments

Comments
 (0)