cloudsigma / cgroupspy Goto Github PK
View Code? Open in Web Editor NEWPython library for managing cgroups
License: BSD 3-Clause "New" or "Revised" License
Python library for managing cgroups
License: BSD 3-Clause "New" or "Revised" License
hi,
don't really have experience with python, but since I'm browsing cgroup libraries at the moment I noticed the following: if I create a cgroup I can pass a string as the group name to the create_cgroup
function, and the name is encoded before it's used, but if I want to delete the same cgroup later with delete_cgroup
I need to pass it a binary string b"..." otherwise I get a TypeError (can't mix strings and bytes in path components).
Is this intended behaviour or a missing encode before join?
EDIT: it's the same error as in this commit: 9baa994
Example
from cgroupspy import trees
t = trees.Tree()
# passing a string works
t.root.create_cgroup("testcgroupspy")
# type error
t.root.delete_cgroup("testcgroupspy")
# works
t.root.delete_cgroup(b"testcgroupspy")
it seems that this library didn't support bind a process to some created node.
I did something like following, it turns out had none effect and node.controller.procs kept empty.
node.controller.procs.append(2341)
It looks like only 0.1.2 is available via pip but 0.1.3 is latest version in GH.
Hi,
It seems cgroupspy
is not working with python 3.10 with this kind of error:
ImportError: cannot import name 'Iterable' from 'collections' (/usr/local/lib/python3.10/collections/__init__.py)
As per Python collections documentation, Iterable
has been moved to collections.abc
since 3.3 and left for compatibility until 3.9 included: https://docs.python.org/3.9/library/collections.html.
A suggestion for cgroupspy/interfaces.py
:
Replace
from collections import Iterable
By
if sys.version_info.major == 3 and sys.version_info.minor >= 3:
from collections.abc import Iterable
else:
from collections import Iterable
or equivalent in order to have a distinction between Python 3.3 and older.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.