You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+13-9
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,12 @@
1
-
# scheduler-profilers
1
+
# dask-profiling
2
2
3
-
Profile the dask [distributed](https://github.com/dask/distributed)scheduler with [py-spy](https://github.com/benfred/py-spy) or [viztracer](https://github.com/gaogaotiantian/viztracer).
3
+
Profile dask [distributed](https://github.com/dask/distributed)clusters with [py-spy](https://github.com/benfred/py-spy) or [viztracer](https://github.com/gaogaotiantian/viztracer).
@@ -32,25 +32,29 @@ Using `pyspy_on_scheduler` or `viztrace_scheduler` attaches a profiler to the sc
32
32
33
33
By default, py-spy profiles are recorded in [speedscope](https://www.speedscope.app/) format. [Viztracer profiles](https://viztracer.readthedocs.io/en/latest/basic_usage.html#display-report) are recorded in Chrome trace format, viewable with [Perfetto](https://ui.perfetto.dev/) or <chrome://tracing>.
34
34
35
-
`scheduler-profilers` (and, transitively, `py-spy`/`viztracer`) must be installed in the environment where the scheduler is running.
35
+
`dask-profiling` (and, transitively, `py-spy`/`viztracer`) must be installed in the environment where the scheduler is running.
You may need to run the scheduler process as root for py-spy to be able to profile it (especially on macOS). See https://github.com/benfred/py-spy#when-do-you-need-to-run-as-sudo.
45
+
**tl;dr:**
46
+
* On macOS, you have to launch your cluster with `sudo`
47
+
* For `docker run`, pass `--cap-add SYS_PTRACE`, or download this newer [`seccomp.json`](https://github.com/moby/moby/blob/d39b075302c27f77b2de413697a5aacb034d8286/profiles/seccomp/default.json) file and use `--seccomp=default.json`.
46
48
47
-
In a Docker container, `scheduler-profilers` will "just work" for Docker/moby versions >= 21.xx. As of right now (May 2021), Docker 21.xx doesn't exist yet, so read on.
49
+
You may need to run the dask process as root for py-spy to be able to profile it (especially on macOS). See https://github.com/benfred/py-spy#when-do-you-need-to-run-as-sudo.
48
50
49
-
[moby/moby#42083](https://github.com/moby/moby/pull/42083/files) recently allowlisted the `process_vm_readv` system call that py-spy uses, which used to be blocked unless you set `--cap-add SYS_PTRACE`. This has been reasonable/safe to do for a while, but just wasn't enabled. So your options right now are:
51
+
In a Docker container, `dask-profiling` will "just work" for Docker/moby versions >= 21.xx. As of right now (Nov 2022), Docker 21.xx doesn't exist yet, so read on.
52
+
53
+
[moby/moby#42083](https://github.com/moby/moby/pull/42083/files) recently allowlisted the `process_vm_readv` system call that py-spy uses, which used to be blocked unless you set `--cap-add SYS_PTRACE`. Allowing this specific system call in unprivileged containers has been safe to do for a while (since linux kernel versions > 4.8), but just wasn't enabled in Docker. So your options right now are:
50
54
* (low/no security impact) Download the newer [`seccomp.json`](https://github.com/moby/moby/blob/d39b075302c27f77b2de413697a5aacb034d8286/profiles/seccomp/default.json) file from moby/master and pass it to Docker via `--seccomp=default.json`.
51
55
* (more convenient) Pass `--cap-add SYS_PTRACE` to Docker. This enables more than you need, but it's one less step.
52
56
53
-
On Ubuntu-based containers, ptrace system calls are [further blocked](https://www.kernel.org/doc/Documentation/admin-guide/LSM/Yama.rst): processes are prohibited from ptracing each other even within the same UID. To work around this, `scheduler-profilers` automatically uses [`prctl(2)`](https://man7.org/linux/man-pages/man2/prctl.2.html) to mark the scheduler process as ptrace-able by itself and any child processes, then launches py-spy as a child process.
57
+
On Ubuntu-based containers, ptrace system calls are [further blocked](https://www.kernel.org/doc/Documentation/admin-guide/LSM/Yama.rst): processes are prohibited from ptracing each other even within the same UID. To work around this, `dask-profiling` automatically uses [`prctl(2)`](https://man7.org/linux/man-pages/man2/prctl.2.html) to mark the scheduler process as ptrace-able by itself and any child processes, then launches py-spy as a child process.
0 commit comments