Skip to main content
https://img.shields.io/badge/code%20style-black-000000.svg Documentation Status

Resource Availability Profile

This Python library provides a data structure, termed availability profile, for managing the availability of computing resources. The structure is handy for simulations and experiments where one must track the compute cluster resources allocated to jobs or tasks over time. The following provides examples of using the discrete resource range, set, and profile, which use int as data type, but the same concepts apply to profiles for other data types.

One can use the discrete (int) range, set, and profile to track the availability of, for instance, CPUs or cluster nodes. To create ranges with resources 0..20 and 30..50 and add them to a set:

from availability.sets import DiscreteRange, DiscreteSet
span1 = DiscreteRange(0, 20)
span2 = DiscreteRange(30, 50)
res_set = DiscreteSet([span1, span2])

Although you can create ranges and sets, one will not manipulate them directly. For tracking the resources available over time, one will likely use an availability profile (discrete or continuous, depending on the type of resource they are dealing with). To create an availability profile with a maximum capacity of 100 discrete resources for tracking the availability of cluster nodes, for instance, one can use the following:

from availability.profile import DiscreteProfile
profile = DiscreteProfile(max_capacity=100)

If you are using the profile in a task-scheduling simulation, you can use the method allocate_resources() from the profile to remove the resource range 0..10 assigned to the task:

profile.allocate_resources(
    resources=DiscreteSet(
        [DiscreteRange(0, 10)]
    ),
    start_time=0,
    end_time=10
)

To find the time at which a task requiring 40 resources for 50 time units can start:

slot = profile.find_start_time(
    quantity=40, ready_time=5, duration=50
)

The returned slot will resemble:

TimeSlot(
    period=DiscreteRange(0, 50),
    resources=DiscreteSet([DiscreteRange(10, 100)])
)

The profile provides other methods, such as check_availability() to check whether a given quantity of resources is available over a given period:

slot = profile.check_availability(
    quantity=10, start_time=5, duration=50
)

One can use the methods free_time_slots() or scheduling_options() to obtain the list of time slots and resources available. The main difference between them is that the time slots returned by the latter may overlap as they represent all the scheduling possibilities for scheduling a job, given the resource availability over the specified period:

slots = profile.scheduling_options(
    start_time=10,
    end_time=100,
    min_duration=20,
    min_quantity=5
)

The operations for querying the resources available during a period return the complete set of resources available. This design allows a user to implement their resource selection policy. However, you can use select_resources() or select_slot_resources() to select a given number of resources from a set or slot:

slot = profile.find_start_time(
    quantity=5, ready_time=0, duration=10
)
selected = profile.select_resources(
    resources=slot.resources, quantity=5)
)

Metadata

Release files for availability-profile 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for availability-profile 0.0.1
File Size Uploaded Provenance Actions
availability-profile-0.0.1.tar.gz 14.0 kB Without provenance Details for availability-profile-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for availability-profile 0.0.1
File Interpreter ABI Platform Actions
availability_profile-0.0.1-py3-none-any.whl Python 3 none any Details for availability_profile-0.0.1-py3-none-any.whl

Total release size: 26.5 kB

Release files / availability-profile-0.0.1.tar.gz

Download URL availability-profile-0.0.1.tar.gz
Size 14.0 kB
Tags Source
SHA-256 checksum
How to use checksums
21f37209d48d54b783b692089996bb17c795c1babd14449fdd974b8e647dfa9b
BLAKE2b-256 checksum
How to use checksums
afffe2ffe958b243e7e2fc109f8bb529db5422f5838cc9d5a297ea12a38294ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.4

Release files / availability_profile-0.0.1-py3-none-any.whl

Download URL availability_profile-0.0.1-py3-none-any.whl
Size 12.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2ba05d44efbb2f347b814e17a3722e793720685b35bfd6c035970cdbbeceaab3
BLAKE2b-256 checksum
How to use checksums
f4d5ddfe56ea0d1d0acf31c4e44a435b3e2e16125643a67848034dd14ac7fab5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.4

Security for availability-profile 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page