{ "info": { "author": "Ivelin Slavov", "author_email": "ivelin.slavov@cloudsigma.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Intended Audience :: System Administrators", "License :: OSI Approved :: BSD License", "Programming Language :: Python" ], "description": "[![Build Status](https://travis-ci.org/cloudsigma/cgroupspy.svg)](https://travis-ci.org/cloudsigma/cgroupspy)\ncgroupspy\n=========\n\nPython library for managing cgroups\n\nThe library provides a pythonic way to manage and represent cgroups. It provides interfaces that convert\npython objects to cgroups compatible strings and vise versa.\n\n\nTrees\n-----\ncgroupspy has a couple of ways to represent the cgroups filesystem\n\n* As a tree - this is the most basic and generic way to represent them. You basically construct it from all\nthe directories in the cgroups root.\n\n* A grouped tree - that has access to all cgroup partitions with the same name, on the same level. For example -\n'machine' partition in memory, cpuset, cpus, etc cgroups. All these attributes are\naccessed via machine.cpus, machine.cpuset, etc.\n\n* A VMTree - a subclass of grouped tree with utilities for simple management of libvirt guests\n\nExample usage\n-------------\n```python\n#Import the trees module, which contains a tree representation of cgroups\n>>> from cgroupspy import trees\n\n# This is the most basic type of cgroup tree. It models the filesystem.\n>>> t = trees.Tree()\n\n# It has a root which is of type Node\n>>> t.root\n\n\n# And the root has children\n>>> print(t.root.children)\n[, , , , , , , , , , , , ]\n\n# You can for example get the cpuset\n>>> cset = t.get_node_by_path('/cpuset/')\n>>> cset\n\n\n# The controller used for this cgroup is a CpuSetController\n>>> cset.controller\n\n\n# Which can for example show you the cpu pinning\n>>> cset.controller.cpus\nset([0, 1])\n\n# You can create a cgroup\n>>> test = cset.create_cgroup('test')\n\n\n# See its cpu restrictions\n>>> test.controller.cpus\nset([0, 1])\n\n# And change them\n>>> test.controller.cpus = [1]\n\n# The tasks in this cgroup are now restricted to cpu 1\n>>> test.controller.cpus\nset([1])\n```\n\nAnother example with the VMTree - for managing libvirt guests\n\n```python\n>>> from cgroupspy.trees import VMTree\n>>> vmt = VMTree()\n>>> print(vmt.vms)\n{u'1ce10f47-fb4e-4b6a-8ee6-ba34940cdda7.libvirt-qemu': ,\n u'3d5013b9-93ed-4ef1-b518-a2cea43f69ad.libvirt-qemu': ,\n}\n\n>>> vm = vmt.get_vm_node(\"1ce10f47-fb4e-4b6a-8ee6-ba34940cdda7\")\n>>> print(vm.cpu.shares)\n1024\n>>> print(vm.cpuset.cpus)\n{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}\n>>> print(vm.memory.limit_in_bytes)\n25603080192\n>>> print(vm.children)\n[,\n ,\n ]\n>>> print(vm.path)\n/machine/grey/1ce10f47-fb4e-4b6a-8ee6-ba34940cdda7.libvirt-qemu\n>>> vcpu1 = vm.children[0]\n>>> print(vcpu1.cpuset.cpus)\n{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}\n\n>>> vcpu1.cpuset.cpus = {1,2,3}\n\n>>> print(vcpu1.cpuset.cpus)\n{1, 2, 3}\n```\n\nLicense\n-------\nnew BSD licence", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/cloudsigma/cgroupspy", "keywords": "cgroups", "license": "New BSD", "maintainer": "", "maintainer_email": "", "name": "cgroupspy", "package_url": "https://pypi.org/project/cgroupspy/", "platform": "", "project_url": "https://pypi.org/project/cgroupspy/", "project_urls": { "Homepage": "https://github.com/cloudsigma/cgroupspy" }, "release_url": "https://pypi.org/project/cgroupspy/0.1.6/", "requires_dist": null, "requires_python": "", "summary": "Python library for managing cgroups", "version": "0.1.6" }, "last_serial": 3068690, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "31a95401d5ffea013e4215366c555664", "sha256": "eb373c52af58769ab81ccf955af4cb5e956088f62141a2629e21a86f57188559" }, "downloads": -1, "filename": "cgroupspy-0.1.0.tar.gz", "has_sig": false, "md5_digest": "31a95401d5ffea013e4215366c555664", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7786, "upload_time": "2014-11-25T14:35:53", "url": "https://files.pythonhosted.org/packages/d5/19/bbc19eec21a7821932d5b75a09f10a7989abdcb94fb2d4135e735da23c32/cgroupspy-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "035ced1fb3105f321dd374d2f5a4a4a4", "sha256": "6427889ff7a5791c838d3ce17bb76b7d82047337c73c1c92f38c3d76b708843c" }, "downloads": -1, "filename": "cgroupspy-0.1.1.tar.gz", "has_sig": false, "md5_digest": "035ced1fb3105f321dd374d2f5a4a4a4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8994, "upload_time": "2015-02-03T13:31:00", "url": "https://files.pythonhosted.org/packages/d2/b8/91cd9f2b0771c3f5bb7f88d69fd6c9e464f38925fc3844b912ea34e4486c/cgroupspy-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "228ead2f16f55550ccb5340fbe246ebe", "sha256": "6a86bf4ce135834704c0772bb5d626ad485df65a0b357cd0f5de12291342892c" }, "downloads": -1, "filename": "cgroupspy-0.1.2.tar.gz", "has_sig": false, "md5_digest": "228ead2f16f55550ccb5340fbe246ebe", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8992, "upload_time": "2015-02-03T13:43:10", "url": "https://files.pythonhosted.org/packages/f1/18/d813a031faf6fa16e115af9cfa7dc0efbf3c490826297098d25aeb7ad76f/cgroupspy-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "e6f894fbd4074217a055509fbd921a06", "sha256": "4768dadd6e74d7c33ec87671f908fb27f12e067be4cf181bf8fb7cc0c4825e14" }, "downloads": -1, "filename": "cgroupspy-0.1.3.tar.gz", "has_sig": false, "md5_digest": "e6f894fbd4074217a055509fbd921a06", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10900, "upload_time": "2016-06-27T17:43:14", "url": "https://files.pythonhosted.org/packages/d6/4c/de8519ac50ab4198d0a9a206303cf6032cdd2e7dfa7b765c92e61b252700/cgroupspy-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "b047ac1b6db14931ffcbf666e6c35ef5", "sha256": "055d4658d792451a5f635c3e50524b6901810e85bf6e620655a8d5b3fa80afb6" }, "downloads": -1, "filename": "cgroupspy-0.1.4.tar.gz", "has_sig": false, "md5_digest": "b047ac1b6db14931ffcbf666e6c35ef5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10933, "upload_time": "2016-06-27T17:45:48", "url": "https://files.pythonhosted.org/packages/34/70/7a925cd3220d2cfccd3593da3b17584ecee8de77f2dc200afb6f8209c7ca/cgroupspy-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "68a20130bb8fb9411cfff6660bba5525", "sha256": "69d5e16162b2f6b4ccdc3bdc354346a6f0a6003bce94d9a156ca0ed28be28087" }, "downloads": -1, "filename": "cgroupspy-0.1.5.tar.gz", "has_sig": false, "md5_digest": "68a20130bb8fb9411cfff6660bba5525", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10952, "upload_time": "2016-09-01T05:54:41", "url": "https://files.pythonhosted.org/packages/93/5e/f29c9f48e056f71eb8418de5a03fb28732567c7559a38ff4ffe32f89f295/cgroupspy-0.1.5.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "7f4dcea944ad674fb6b2999e295ea1be", "sha256": "fb4aac7938499cff53c260112fb0759a54fb5f8bad89d9be0326c70a7619821a" }, "downloads": -1, "filename": "cgroupspy-0.1.6.tar.gz", "has_sig": false, "md5_digest": "7f4dcea944ad674fb6b2999e295ea1be", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14491, "upload_time": "2017-08-03T01:20:11", "url": "https://files.pythonhosted.org/packages/a5/ad/b37eda48b6be8a13654e823579a9a686d13f60c66b2e97216eced166a2e5/cgroupspy-0.1.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7f4dcea944ad674fb6b2999e295ea1be", "sha256": "fb4aac7938499cff53c260112fb0759a54fb5f8bad89d9be0326c70a7619821a" }, "downloads": -1, "filename": "cgroupspy-0.1.6.tar.gz", "has_sig": false, "md5_digest": "7f4dcea944ad674fb6b2999e295ea1be", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14491, "upload_time": "2017-08-03T01:20:11", "url": "https://files.pythonhosted.org/packages/a5/ad/b37eda48b6be8a13654e823579a9a686d13f60c66b2e97216eced166a2e5/cgroupspy-0.1.6.tar.gz" } ] }