k3cgrouparch
This lib is used to set up cgroup directory tree according to configuration saved in zookeeper, and add pid to cgroup accordingly.
k3cgrouparch is a component of pykit3 project: a python3 toolkit set.
Name
cgrouparch
A python lib used to build cgroup directory tree, add set cgroup pid.
Status
This library is considered production ready.
It supports only cgroup v1.
It manages the cpu and blkio subsystems in <cgroup_dir>/<subsystem>,
such as /sys/fs/cgroup/cpu.
It uses v1 files such as cpu.shares, blkio.weight and tasks.
A host that mounts only the cgroup v2 unified hierarchy has none of these files.
Description
This lib is used to set up cgroup directory tree according to configuration saved in zookeeper, and add pid to cgroup accordingly.
Install
pip install k3cgrouparch
Synopsis
# {
# 'cpu': {
# 'sub_cgroup': {
# 'test_cgroup_a': {
# 'conf': {
# 'share': 1024,
# },
# },
# 'test_cgroup_b': {
# 'conf': {
# 'share': 100,
# },
# 'sub_cgroup': {
# 'test_cgroup_b_sub1': {
# 'conf': {
# 'share': 200,
# },
# },
# },
# },
# },
# },
# }
from k3cgrouparch import manager
def get_cgroup_pid_file(cgroup_name):
if cgroup_name == "test_cgroup_a":
return ["/tmp/test.pid"]
# ...
def get_zk_host():
return "127.0.0.1:2181,1.2.3.4:2181"
argkv = {
"cgroup_dir": "/sys/fs/cgroup",
"get_cgroup_pid_file": get_cgroup_pid_file,
"get_zk_host": get_zk_host,
"zk_prefix": "/cluster_a/service_rank",
"zk_auth_data": [("digest", "super:123456")],
"communicate_ip": "127.0.0.1",
"communicate_port": 3344,
"redis_ip": "127.0.0.1",
"redis_port": 6379,
}
manager.run(**argkv)
argkv = {
"cgroup_dir": "/sys/fs/cgroup",
"get_zk_host": get_zk_host,
"zk_prefix": "/cluster_a/service_rank",
"zk_auth_data": [("digest", "super:123456")],
}
cgexec_arg = manager.get_cgexec_arg(["test_cgroup_a"], **argkv)
# return like:
# {
# 'test_cgroup_a': ' -g cpu:/test_cgroup_a',
# }
Author
Zhang Yanpo (张炎泼) drdr.xp@gmail.com
Copyright and License
The MIT License (MIT)
Copyright (c) 2015 Zhang Yanpo (张炎泼) drdr.xp@gmail.com
Metadata
Release files for k3cgrouparch 0.1.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 | Actions |
|---|---|---|---|---|
| k3cgrouparch-0.1.7.tar.gz | 13.5 kB | Without provenance | Details for k3cgrouparch-0.1.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| k3cgrouparch-0.1.7-py3-none-any.whl | Python 3 | none | any | Details for k3cgrouparch-0.1.7-py3-none-any.whl |
Total release size: 26.2 kB
Release files / k3cgrouparch-0.1.7.tar.gz
| Download URL | k3cgrouparch-0.1.7.tar.gz |
|---|---|
| Size | 13.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f054e22f17ee8d02ad105e3d03c3763d4cc48d52e00d6b24a229e70695ae0b83
|
|
BLAKE2b-256 checksum How to use checksums |
dafcbc7d681982122931064582720ad976c993f8f70c5bea5b7781dbb29b13d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Release files / k3cgrouparch-0.1.7-py3-none-any.whl
| Download URL | k3cgrouparch-0.1.7-py3-none-any.whl |
|---|---|
| Size | 12.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4a63e2bd81e7e4a04e8a5011e558627cff1e586894f457acee1ee92306eda968
|
|
BLAKE2b-256 checksum How to use checksums |
0d6ccc610e087c527cf71c98a47ec88c2712ec8378d3e8876e1426dbbd2f92de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Security for k3cgrouparch 0.1.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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.