availability-profile


Nameavailability-profile JSON
Version 0.0.1 PyPI version JSON
download
home_page
SummaryData Structure for Tracking Computing Resource Availability
upload_time2023-07-16 17:56:52
maintainer
docs_urlNone
author
requires_python<4,>=3.7
licenseMIT
keywords data structure resources simulation scheduling
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. image:: https://img.shields.io/badge/code%20style-black-000000.svg
    :target: https://github.com/psf/black
.. image:: https://readthedocs.org/projects/resource-availability/badge/?version=latest
    :target: https://resource-availability.readthedocs.io/en/latest/?badge=latest
    :alt: Documentation Status

Resource Availability Profile
=============================

.. inclusion-marker-do-not-remove

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:

.. code-block:: python

    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:

.. code-block:: python

    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:

.. code-block:: python

    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:

.. code-block:: python

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

The returned `slot` will resemble:

.. code-block:: python

    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:

.. code-block:: python

    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:

.. code-block:: python

    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:

.. code-block:: python

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

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "availability-profile",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "<4,>=3.7",
    "maintainer_email": "Marcos Dias de Assuncao <assuncao@acm.org>",
    "keywords": "data structure,resources,simulation,scheduling",
    "author": "",
    "author_email": "Marcos Dias de Assuncao <assuncao@acm.org>",
    "download_url": "https://files.pythonhosted.org/packages/af/ff/e2ffe958b243e7e2fc109f8bb529db5422f5838cc9d5a297ea12a38294ee/availability-profile-0.0.1.tar.gz",
    "platform": null,
    "description": ".. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n    :target: https://github.com/psf/black\n.. image:: https://readthedocs.org/projects/resource-availability/badge/?version=latest\n    :target: https://resource-availability.readthedocs.io/en/latest/?badge=latest\n    :alt: Documentation Status\n\nResource Availability Profile\n=============================\n\n.. inclusion-marker-do-not-remove\n\nThis Python library provides a data structure, termed **availability profile**,\nfor managing the availability of computing resources. The structure is handy\nfor simulations and experiments where one must track the compute cluster\nresources allocated to jobs or tasks over time. The following provides\nexamples of using the discrete resource range, set, and profile,\nwhich use `int` as data type, but the same concepts apply to profiles for\nother data types.\n\nOne can use the discrete (`int`) range, set, and profile to track the\navailability of, for instance, CPUs or cluster nodes. To create ranges\nwith resources `0..20` and `30..50` and add them to a set:\n\n.. code-block:: python\n\n    from availability.sets import DiscreteRange, DiscreteSet\n    span1 = DiscreteRange(0, 20)\n    span2 = DiscreteRange(30, 50)\n    res_set = DiscreteSet([span1, span2])\n\nAlthough you can create ranges and sets, one will not manipulate them\ndirectly. For tracking the resources available over time, one will likely\nuse an availability profile (discrete or continuous, depending on the\ntype of resource they are dealing with). To create an availability profile\nwith a maximum capacity of 100 discrete resources for tracking the\navailability of cluster nodes, for instance, one can use the following:\n\n.. code-block:: python\n\n    from availability.profile import DiscreteProfile\n    profile = DiscreteProfile(max_capacity=100)\n\nIf you are using the profile in a task-scheduling simulation, you can\nuse the method `allocate_resources()` from the profile to remove the\nresource range `0..10` assigned to the task:\n\n.. code-block:: python\n\n    profile.allocate_resources(\n        resources=DiscreteSet(\n            [DiscreteRange(0, 10)]\n        ),\n        start_time=0,\n        end_time=10\n    )\n\nTo find the time at which a task requiring `40` resources\nfor `50` time units can start:\n\n.. code-block:: python\n\n    slot = profile.find_start_time(\n        quantity=40, ready_time=5, duration=50\n    )\n\nThe returned `slot` will resemble:\n\n.. code-block:: python\n\n    TimeSlot(\n        period=DiscreteRange(0, 50),\n        resources=DiscreteSet([DiscreteRange(10, 100)])\n    )\n\nThe profile provides other methods, such as `check_availability()`\nto check whether a given quantity of resources is available over a\ngiven period:\n\n.. code-block:: python\n\n    slot = profile.check_availability(\n        quantity=10, start_time=5, duration=50\n    )\n\nOne can use the methods `free_time_slots()` or `scheduling_options()`\nto obtain the list of time slots and resources available. The main\ndifference between them is that the time slots returned by the latter\nmay overlap as they represent all the scheduling possibilities for\nscheduling a job, given the resource availability over the specified\nperiod:\n\n.. code-block:: python\n\n    slots = profile.scheduling_options(\n        start_time=10,\n        end_time=100,\n        min_duration=20,\n        min_quantity=5\n    )\n\nThe operations for querying the resources available during a period\nreturn the complete set of resources available. This design allows a\nuser to implement their resource selection policy. However, you\ncan use `select_resources()` or `select_slot_resources()` to\nselect a given number of resources from a set or slot:\n\n.. code-block:: python\n\n    slot = profile.find_start_time(\n        quantity=5, ready_time=0, duration=10\n    )\n    selected = profile.select_resources(\n        resources=slot.resources, quantity=5)\n    )\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Data Structure for Tracking Computing Resource Availability",
    "version": "0.0.1",
    "project_urls": {
        "Bug Reports": "https://github.com/assuncaomarcos/resource-availability",
        "Homepage": "https://github.com/assuncaomarcos/resource-availability",
        "Say Thanks!": "https://saythanks.io/to/assuncaomarcos",
        "Source": "https://github.com/assuncaomarcos/resource-availability",
        "documentation": "http://resource-availability.readthedocs.io/"
    },
    "split_keywords": [
        "data structure",
        "resources",
        "simulation",
        "scheduling"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f4d5ddfe56ea0d1d0acf31c4e44a435b3e2e16125643a67848034dd14ac7fab5",
                "md5": "fa316ac76507cf518a3cc40325ad1d88",
                "sha256": "2ba05d44efbb2f347b814e17a3722e793720685b35bfd6c035970cdbbeceaab3"
            },
            "downloads": -1,
            "filename": "availability_profile-0.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fa316ac76507cf518a3cc40325ad1d88",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4,>=3.7",
            "size": 12464,
            "upload_time": "2023-07-16T17:56:50",
            "upload_time_iso_8601": "2023-07-16T17:56:50.593815Z",
            "url": "https://files.pythonhosted.org/packages/f4/d5/ddfe56ea0d1d0acf31c4e44a435b3e2e16125643a67848034dd14ac7fab5/availability_profile-0.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "afffe2ffe958b243e7e2fc109f8bb529db5422f5838cc9d5a297ea12a38294ee",
                "md5": "b61eaaecf0dc41948d552ec92af4b66e",
                "sha256": "21f37209d48d54b783b692089996bb17c795c1babd14449fdd974b8e647dfa9b"
            },
            "downloads": -1,
            "filename": "availability-profile-0.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "b61eaaecf0dc41948d552ec92af4b66e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4,>=3.7",
            "size": 14016,
            "upload_time": "2023-07-16T17:56:52",
            "upload_time_iso_8601": "2023-07-16T17:56:52.442301Z",
            "url": "https://files.pythonhosted.org/packages/af/ff/e2ffe958b243e7e2fc109f8bb529db5422f5838cc9d5a297ea12a38294ee/availability-profile-0.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-16 17:56:52",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "assuncaomarcos",
    "github_project": "resource-availability",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "availability-profile"
}
        
Elapsed time: 0.17400s