File: README.rst

package info (click to toggle)
python-procset 1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 532 kB
  • sloc: python: 2,607; makefile: 22
file content (57 lines) | stat: -rw-r--r-- 1,092 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
==========
procset.py
==========

Toolkit to manage sets of closed intervals.

`procset` is a pure python module to manage sets of closed intervals. It can be
used as a small python library to manage sets of resources, and is especially
useful when writing schedulers.


Features
--------

- Free Software: licensed under LGPLv3 (see `<LICENSE.rst>`_).
- Pure Python module :)
- Thoroughly tested!


Limitations
-----------

- The provided implementation target only Python 3 (I do not want to maintain
  old stuff :P).
- The intervals bounds have to be non-negative integers.


Requirements
------------

- `setuptools>=34.4.0`


Example use
-----------

What does it look like to use ``procset``?  Here is a simple example program:

.. code:: python

   from procset import ProcSet


   free_cores = ProcSet((0, 7))  # I have 8 cores to work with

   job_cores = ProcSet((2, 5))  # let's use some cores for a job
   free_cores -= job_cores

   print('remaining cores:', str(free_cores))


And it looks like this when run:

.. code:: bash

   $ python example.py
   remaining cores: 0-1 6-7