This lib is used to set up cgroup directory tree according to configuration saved in zookeeper, and add pid to cgroup accordingly.
Project description
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.
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': '/cluser_a/service_rank',
'zk_auth_data': [('digest', 'super:123456')],
'communicate_ip': '127.0.0.1',
'communicate_port': '3344',
}
manager.run(**argkv)
argkv = {
'cgroup_dir': '/sys/fs/cgroup',
'get_zk_host': get_zk_host,
'zk_prefix': '/cluser_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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file k3cgrouparch-0.1.0.tar.gz
.
File metadata
- Download URL: k3cgrouparch-0.1.0.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7fd30a9da6a9bf97c788275697267cbe8321e0a5514689dbe49299e5382ae5a7 |
|
MD5 | 1faad644cbc4b64614164602a0dc22a4 |
|
BLAKE2b-256 | 9cf69b20bf54369c2804057178b55bf55b5c8e00619af6afbd7565d5490ce009 |
File details
Details for the file k3cgrouparch-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: k3cgrouparch-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 284182656458d37e33df269dd8ea20168f8278c9c9b07c2493bf807de2c507c9 |
|
MD5 | 56da9c76d5b1f6e840e2d8769b918abc |
|
BLAKE2b-256 | 7c9530e60ce8929606115178b231c7945ba6e33650a5293c85c6d061d7d3c212 |