Skip to content

Commit 5982734

Browse files
committed
Merge remote-tracking branch 'origin/master' into sciagraph-multiprocessing
2 parents a0b6056 + b90dd55 commit 5982734

File tree

7 files changed

+93
-29
lines changed

7 files changed

+93
-29
lines changed

.github/dependabot.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@ updates:
99
directory: "/" # Location of package manifests
1010
schedule:
1111
interval: "daily"
12+
- package-ecosystem: "github-actions"
13+
directory: "/"
14+
schedule:
15+
interval: "daily"

.github/workflows/benchmarks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
PYTHONFAULTHANDLER: "true"
2626

2727
steps:
28-
- uses: "actions/checkout@v2"
28+
- uses: "actions/checkout@v3"
2929
with:
3030
# We need tags to get the correct code version:
3131
fetch-depth: 0

.github/workflows/main.yml

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ jobs:
3232
PYTHONFAULTHANDLER: "true"
3333

3434
steps:
35-
- uses: "actions/checkout@v2"
35+
- uses: "actions/checkout@v3"
3636
with:
3737
# We need tags to get the correct code version:
3838
fetch-depth: 0
39-
- uses: "actions/setup-python@v2"
39+
- uses: "actions/setup-python@v4"
4040
with:
4141
python-version: "${{ matrix.python-version }}"
4242
- uses: "actions-rs/toolchain@v1"
@@ -76,11 +76,11 @@ jobs:
7676
make test
7777
- name: "Build macOS wheels"
7878
if: startsWith(matrix.os, 'mac') && (matrix.python-version == '3.9')
79-
uses: pypa/cibuildwheel@v2.7.0
79+
uses: pypa/cibuildwheel@v2.9.0
8080
env:
8181
MACOSX_DEPLOYMENT_TARGET: "10.15"
8282
CIBW_ARCHS_MACOS: "x86_64 arm64"
83-
CIBW_SKIP: "cp37-macosx_arm64 cp36*"
83+
CIBW_SKIP: "cp37-macosx_arm64 cp36* pp*"
8484
with:
8585
output-dir: dist
8686
- name: "Build manylinux wheels"
@@ -125,7 +125,7 @@ jobs:
125125
name: "Documentation check and publish"
126126
runs-on: "ubuntu-latest"
127127
steps:
128-
- uses: "actions/checkout@v2"
128+
- uses: "actions/checkout@v3"
129129
- name: "Run mdbook"
130130
run: |
131131
set -euo pipefail
@@ -139,3 +139,42 @@ jobs:
139139
set -euo pipefail
140140
curl -X POST -d '{}' "$PUBLISH_DOCS_HOOK"
141141
142+
arm-wheels:
143+
name: "Wheels for ARM64"
144+
runs-on: "ubuntu-latest"
145+
if: startsWith(github.event.ref, 'refs/tags')
146+
env:
147+
CIBW_ARCHS_LINUX: aarch64
148+
CIBW_BEFORE_ALL_LINUX: "curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y"
149+
CIBW_BEFORE_BUILD: "touch filpreload/src/_filpreload.c" # force rebuild of Python code with new interpreter
150+
CIBW_ENVIRONMENT: 'PATH="$PATH:$HOME/.cargo/bin"'
151+
CIBW_SKIP: "cp27-* cp34-* cp35-* cp36-* cp311-* pp* *-musllinux*"
152+
CIBW_TEST_COMMAND: python -m filprofiler run {project}/benchmarks/pystone.py
153+
steps:
154+
- uses: actions/checkout@v3
155+
with:
156+
# We need tags to get the correct code version:
157+
fetch-depth: 0
158+
- name: Set up QEMU
159+
if: runner.os == 'Linux'
160+
uses: docker/setup-qemu-action@v2
161+
with:
162+
platforms: arm64
163+
- name: Build wheels
164+
uses: pypa/cibuildwheel@v2.9.0
165+
with:
166+
output-dir: dist
167+
- uses: actions/upload-artifact@v2
168+
with:
169+
name: "arm64-wheel"
170+
path: dist/*.whl
171+
- name: Publish distribution 📦 to PyPI
172+
if: startsWith(github.event.ref, 'refs/tags')
173+
env:
174+
TWINE_USERNAME: __token__
175+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
176+
run: |
177+
set -euo pipefail
178+
pip install twine
179+
twine check dist/*.whl
180+
twine upload --repository pypi dist/filprofiler*.whl

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Release notes
22

3+
## Fil 2022.09.0 (2022-09-12)
4+
5+
### Features
6+
7+
- Added wheels for ARM on Linux (`aarch64`), useful for running native Docker images on ARM Macs. ([#395](https://github.com/pythonspeed/filprofiler/issues/395))
8+
39
## Fil 2022.07.0 (2022-07-22)
410

511
### Bugfixes

Cargo.lock

Lines changed: 28 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

memapi/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ license = "Apache-2.0"
1010
[dependencies]
1111
im = "15"
1212
itertools = "0.10"
13-
ahash = "0.7"
13+
ahash = "0.8"
1414
derivative = "2.2"
1515
lazy_static = "1.4"
1616
backtrace = "0.3"
17-
once_cell = "1.13"
17+
once_cell = "1.14"
1818
libloading = "0.7"
1919
libc = "0.2"
2020
serde = {version = "1", features = ["derive"] }

memapi/src/oom.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ fn get_cgroup_paths<'a>(proc_cgroups: &'a str) -> Vec<&'a str> {
149149
/// Real system information.
150150
pub struct RealMemoryInfo {
151151
// The current process.
152-
process: psutil::process::Process,
152+
process: Option<psutil::process::Process>,
153153
// On Linux, the current cgroup _at startup_. If it changes after startup,
154154
// we'll be wrong, but that's unlikely.
155155
#[cfg(target_os = "linux")]
@@ -191,14 +191,14 @@ impl RealMemoryInfo {
191191
};
192192
Self {
193193
cgroup: cgroup,
194-
process: psutil::process::Process::current().unwrap(),
194+
process: psutil::process::Process::current().ok(),
195195
}
196196
}
197197

198198
#[cfg(target_os = "macos")]
199199
pub fn new() -> Self {
200200
Self {
201-
process: psutil::process::Process::current().unwrap(),
201+
process: psutil::process::Process::current().ok(),
202202
}
203203
}
204204

@@ -244,7 +244,10 @@ impl MemoryInfo for RealMemoryInfo {
244244
}
245245

246246
fn get_resident_process_memory(&self) -> usize {
247-
self.process.memory_info().unwrap().rss() as usize
247+
self.process
248+
.as_ref()
249+
.and_then(|p| p.memory_info().map(|mi| mi.rss()).ok())
250+
.unwrap_or(0) as usize
248251
}
249252

250253
/// Print debugging info to stderr.
@@ -266,7 +269,7 @@ impl MemoryInfo for RealMemoryInfo {
266269
);
267270
eprintln!(
268271
"=fil-profile= Process memory info: {:?}",
269-
self.process.memory_info()
272+
self.process.as_ref().map(|p| p.memory_info())
270273
);
271274
}
272275
}

0 commit comments

Comments
 (0)