Skip to main content

Toolkit to manage sets of closed intervals.

Project description

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!
  • Drop-in replacement for interval_set (see intsetwrap.py).

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:

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:

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for procset, version 1.0
Filename, size File type Python version Upload date Hashes
Filename, size procset-1.0-py3-none-any.whl (12.3 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size procset-1.0.tar.gz (165.2 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page