graph-scheduler


Namegraph-scheduler JSON
Version 1.1.2 PyPI version JSON
download
home_pagehttps://github.com/kmantel/graph-scheduler
SummaryA graph-based scheduler of nodes based on structure and conditions
upload_time2023-04-19 00:42:03
maintainer
docs_urlNone
authorKatherine Mantel, Princeton University
requires_python>=3.7
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Graph Scheduler

[![CI](https://github.com/kmantel/graph-scheduler/actions/workflows/ci.yml/badge.svg)](https://github.com/kmantel/graph-scheduler/actions/workflows/ci.yml)
[![Coverage Status](https://coveralls.io/repos/github/kmantel/graph-scheduler/badge.svg)](https://coveralls.io/github/kmantel/graph-scheduler)

A graph scheduler generates the order in which the nodes of a directed
acyclic graph (DAG) are executed using the structure of the graph and
expressive
[conditions](https://kmantel.github.io/graph-scheduler/Condition.html).
Specifically, a scheduler uses a topological ordering of the nodes as a
base sequence of execution and further restricts execution based on
predefined or custom conditions provided by the user. Patterns of
execution are linked to abstract units of time and may optionally be
mapped to real time units using [pint](https://pint.readthedocs.io/).

Documentation is available on github-pages [for the current
release](https://kmantel.github.io/graph-scheduler/) and [for the
current main
branch](https://kmantel.github.io/graph-scheduler/branch/main). For
prior releases, go to
``https://kmantel.github.io/graph-scheduler/tag/<tag_name>``.

## Installation

Install from pypi:

```sh
pip install graph-scheduler
```

## Example

The graph is specified here in dependency dictionary format, but
[networkx](https://github.com/networkx/networkx) Digraphs are also
supported.

```python
>>> import graph_scheduler

>>> graph = {
    'A': set(),
    'B': {'A'},
    'C': {'A'},
    'D': {'B', 'C'},
}

>>> sched = graph_scheduler.Scheduler(graph=graph)
>>> sched.add_condition('C', graph_scheduler.EveryNCalls('A', 2))
>>> sched.add_condition('D', graph_scheduler.EveryNCalls('C', 2))

>>> print(list(sched.run()))
[{'A'}, {'B'}, {'A'}, {'C', 'B'}, {'A'}, {'B'}, {'A'}, {'C', 'B'}, {'D'}]
```



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/kmantel/graph-scheduler",
    "name": "graph-scheduler",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "",
    "author": "Katherine Mantel, Princeton University",
    "author_email": "kmantel@princeton.edu",
    "download_url": "https://files.pythonhosted.org/packages/ca/23/defc13688d80aeaee42242a0681ace66ff2c9dd2efb989e856158724e87d/graph-scheduler-1.1.2.tar.gz",
    "platform": null,
    "description": "# Graph Scheduler\n\n[![CI](https://github.com/kmantel/graph-scheduler/actions/workflows/ci.yml/badge.svg)](https://github.com/kmantel/graph-scheduler/actions/workflows/ci.yml)\n[![Coverage Status](https://coveralls.io/repos/github/kmantel/graph-scheduler/badge.svg)](https://coveralls.io/github/kmantel/graph-scheduler)\n\nA graph scheduler generates the order in which the nodes of a directed\nacyclic graph (DAG) are executed using the structure of the graph and\nexpressive\n[conditions](https://kmantel.github.io/graph-scheduler/Condition.html).\nSpecifically, a scheduler uses a topological ordering of the nodes as a\nbase sequence of execution and further restricts execution based on\npredefined or custom conditions provided by the user. Patterns of\nexecution are linked to abstract units of time and may optionally be\nmapped to real time units using [pint](https://pint.readthedocs.io/).\n\nDocumentation is available on github-pages [for the current\nrelease](https://kmantel.github.io/graph-scheduler/) and [for the\ncurrent main\nbranch](https://kmantel.github.io/graph-scheduler/branch/main). For\nprior releases, go to\n``https://kmantel.github.io/graph-scheduler/tag/<tag_name>``.\n\n## Installation\n\nInstall from pypi:\n\n```sh\npip install graph-scheduler\n```\n\n## Example\n\nThe graph is specified here in dependency dictionary format, but\n[networkx](https://github.com/networkx/networkx) Digraphs are also\nsupported.\n\n```python\n>>> import graph_scheduler\n\n>>> graph = {\n    'A': set(),\n    'B': {'A'},\n    'C': {'A'},\n    'D': {'B', 'C'},\n}\n\n>>> sched = graph_scheduler.Scheduler(graph=graph)\n>>> sched.add_condition('C', graph_scheduler.EveryNCalls('A', 2))\n>>> sched.add_condition('D', graph_scheduler.EveryNCalls('C', 2))\n\n>>> print(list(sched.run()))\n[{'A'}, {'B'}, {'A'}, {'C', 'B'}, {'A'}, {'B'}, {'A'}, {'C', 'B'}, {'D'}]\n```\n\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A graph-based scheduler of nodes based on structure and conditions",
    "version": "1.1.2",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "33fed13323536ccf014f3f8e17aef97f49389d9e2677ca8d205e4f4903566d18",
                "md5": "94f5baadba71c448b5d5065d95f37365",
                "sha256": "e348e6dca54723c283e59632cb902bbf1489e06a1ad7f369b0677c710e4e5d2e"
            },
            "downloads": -1,
            "filename": "graph_scheduler-1.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "94f5baadba71c448b5d5065d95f37365",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 38763,
            "upload_time": "2023-04-19T00:42:00",
            "upload_time_iso_8601": "2023-04-19T00:42:00.367633Z",
            "url": "https://files.pythonhosted.org/packages/33/fe/d13323536ccf014f3f8e17aef97f49389d9e2677ca8d205e4f4903566d18/graph_scheduler-1.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ca23defc13688d80aeaee42242a0681ace66ff2c9dd2efb989e856158724e87d",
                "md5": "6ac40deb6ec0997130b9532bf7b3a974",
                "sha256": "43a1ab06c0feac1ec5a3fca870280100b4b1fe205752a1b3b4008249d39aa295"
            },
            "downloads": -1,
            "filename": "graph-scheduler-1.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "6ac40deb6ec0997130b9532bf7b3a974",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 74729,
            "upload_time": "2023-04-19T00:42:03",
            "upload_time_iso_8601": "2023-04-19T00:42:03.122170Z",
            "url": "https://files.pythonhosted.org/packages/ca/23/defc13688d80aeaee42242a0681ace66ff2c9dd2efb989e856158724e87d/graph-scheduler-1.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-19 00:42:03",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "kmantel",
    "github_project": "graph-scheduler",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "graph-scheduler"
}
        
Elapsed time: 0.06475s