Provides a foundation for a service that will run an action a regular intervals.
Project description
py-sentry contains the python package that provides a foundation for a micro-service that can either be run once or at a regular interval.
This document outlines how this project can be used. The purpose of this project is described elsewhere, as are the details
Foundational Elements
The IntervalService
A standard py_sentry
executable take the following as demonstrated by the command_service.py
example:
"""
This shows how to create an executeable to run a Task using the
sentry.service module.
"""
from sentry import IntervalService
def main() -> int:
"""
Runs the command_task as a sentry.
"""
service = IntervalService("command_task")
return service.run()
if __name__ == "__main__":
main()
The IntervalService
is designed to execute a named Task. The task itself is declared as a Python entry point. When using a pyproject.toml
file for packaging the task can be declared as follows:
[project.entry-points.sentry]
command_task = "sentry.command_task:CommandTask"
A Task
A Task
is a python class that provide the implementation the behaviour of a micro-service as managed by an IntervalService
. The complete information about how a Task
does this is provided elsewhere
The main concept is that a minimal task must implement the following function:
def __init__(self) -> None:
"""
Creates an instance of this class.
"""
and in most other cases, also implement this other function:
def execute(self) -> None:
"""
Executes the responsibilities of this executable
"""
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
Hashes for py_sentry-1.6.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f842690ecfbc28b116b843590a57967c7283eac4cafaa310c79cd4a979c67b58 |
|
MD5 | 5288b211723cc0a269bfe8729c7c50a2 |
|
BLAKE2b-256 | 07656bfc1411ad0dc2d5ee8c789561b134ce40687ad36880ac7a9f3f6c04a2cf |