Anakin
This is a tool that runs another command, and kills all the orphans it generates.
When a process is killed on Linux, its children are not automatically killed too. Instead they get reparented to the init process and live on. In many cases this is not what you want.
In particular this was written to handle gitlab-runner which runs CI jobs. When a job times out gitlab-runner only kills the process that it started. Any child processes of that may be orphaned and continue running.
Anakin uses Linux's PR_SET_CHILD_SUBREAPER feature to mark itself as the "child subreaper", which means any descendants that are orphaned get reparented to this process, instead of the init process. This process then periodically polls its children and kills any that have been orphaned to it.
Installation
The easiest way to install this is with pip:
python3 -m pip install anakin2
Or if you have Rust:
cargo install anakin
Usage
There are no arguments. Just prefix your command with anakin.
Instead of
my_program --some --args
Run
anakin my_program --some --args
Logging
Logging is controlled by the following environment variables:
ANAKIN_LOG, e.g.ANAKIN_LOG=infowill print when orphans are killed. The default level iserror.ANAKIN_LOG_STYLEcontrols the colour output. It can beauto(default),alwaysornever.ANAKIN_LOG_FILEif set logs to that filename, plus the process ID. Otherwise it logs to stderr.
Metadata
Release files for anakin2 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| anakin2-0.1.0-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl | Python 3 | none | Linux glibc 2.5+ x86-64 | Details for anakin2-0.1.0-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl |
Release files / anakin2-0.1.0-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl
| Download URL | anakin2-0.1.0-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl |
|---|---|
| Size | 928.2 kB |
| Tags | Linux glibc 2.5+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
620b25775cba9d2b0e37b80bb730a532c55c24d608706c16f24ca5f5c8651310
|
|
BLAKE2b-256 checksum How to use checksums |
cca977692c5f3beb7f6be059f4691da40a8f07cdd27c765a1487fc53e10876b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.5
|
Security for anakin2 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.