A graph-based scheduler of nodes based on structure and conditions
Project description
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. 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.
Documentation is available on github-pages for the current
release and for the
current main
branch. For
prior releases, go to
https://kmantel.github.io/graph-scheduler/tag/<tag_name>
.
Installation
Install from pypi:
pip install graph-scheduler
Example
The graph is specified here in dependency dictionary format, but networkx Digraphs are also supported.
>>> 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'}]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file graph-scheduler-1.2.2.tar.gz
.
File metadata
- Download URL: graph-scheduler-1.2.2.tar.gz
- Upload date:
- Size: 95.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d43bcff55decde8106a9b592d8899e788985b504111163545de257cfd7df6ec1 |
|
MD5 | 20399d5e3d9a61be12b3d5bd2dc62d8e |
|
BLAKE2b-256 | ce21df5a22c07318cffd32cecfe5a212d4e37d1e5194e3c96b27ce49a046c119 |
File details
Details for the file graph_scheduler-1.2.2-py3-none-any.whl
.
File metadata
- Download URL: graph_scheduler-1.2.2-py3-none-any.whl
- Upload date:
- Size: 52.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c52be82887e662b13177fdb236ac3ebe45faf7cd404d9321eb7d2c058c1ff088 |
|
MD5 | ea312339cd0ecd1f6c9074acff5368db |
|
BLAKE2b-256 | 04207eb9eed7693379ca4d6082a9f76df7985309d71fbf39ad329d4181c73cdd |