GracefulKiller
GracefulKiller python3 module for process SIGTERM, SIGHUP and SIGINT signals gracefully
Requirements
- signal (build-in)
Details
Preparations
Install GracefulKiller using pip:
pip install [--user] gracefulkiller
Usage
Import module:
from GracefulKiller import GracefulKiller
Example 1
# import module
from GracefulKiller import GracefulKiller
# create killer
killer = GracefulKiller()
# create while loop using killer, will exit from loop if SIGTERM or SIGINT received
while not killer.kill_now:
# do stuff
Example 2
# import module
from GracefulKiller import GracefulKiller
# create killer
killer = GracefulKiller()
# use it as check for SIGTERM and SIGINT
if killer.kill_now:
sys.exit()
Example 3
# import module
from GracefulKiller import GracefulKiller, Loop
# shutdown handler
def shutdown_handler():
print("shutdown")
# create killer with shutdown handler
killer = GracefulKiller(shutdown_handler)
# start killer loop
Loop(killer, 1).start()
Maintainers
Special thanks to:
- williams824 Pull request #1: There is no SIGHUP signal under windows
- cuihairu Pull request #3: a simple loop
Metadata
Release files for GracefulKiller 0.4.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| gracefulkiller-0.4.7.tar.gz | 3.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| GracefulKiller-0.4.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.4 kB
Release files / gracefulkiller-0.4.7.tar.gz
| Download URL | gracefulkiller-0.4.7.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
671678724bb07d2afcee45977229decbf230cb4fa9a916afcc19c810ef4420f4
|
|
BLAKE2b-256 checksum How to use checksums |
a1e47ac0916dca74e178389fe10e930e10230dc5571a3364540646fa38ab5768
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.4
|
Release files / GracefulKiller-0.4.7-py3-none-any.whl
| Download URL | GracefulKiller-0.4.7-py3-none-any.whl |
|---|---|
| Size | 3.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
28c3b5c54e132350c2e6fc48300e113d2428e0cb6ede65a769d65d4dbfe10b7c
|
|
BLAKE2b-256 checksum How to use checksums |
1b8552618791684f92f8b0e44a826c430d78d93a206851906a4dc1d09b545aec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.4
|
Security for GracefulKiller 0.4.7
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.