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.

Source Distribution

procset-1.0.tar.gz (165.2 kB view hashes)

Uploaded source

Built Distribution

procset-1.0-py3-none-any.whl (12.3 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page