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
File details
Details for the file py_sentry-1.6.0.tar.gz
.
File metadata
- Download URL: py_sentry-1.6.0.tar.gz
- Upload date:
- Size: 12.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b9a759f581c7490678ae409a299968cd1e4c56c17ed02893d01f9bca7fd8cb0 |
|
MD5 | c27076a6edaee1605a2745730fdac4fa |
|
BLAKE2b-256 | 7095110dba9308971873b0a09ff7c254bbb966c90de8e8793dd2bc731bdfb99e |
File details
Details for the file py_sentry-1.6.0-py3-none-any.whl
.
File metadata
- Download URL: py_sentry-1.6.0-py3-none-any.whl
- Upload date:
- Size: 18.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f842690ecfbc28b116b843590a57967c7283eac4cafaa310c79cd4a979c67b58 |
|
MD5 | 5288b211723cc0a269bfe8729c7c50a2 |
|
BLAKE2b-256 | 07656bfc1411ad0dc2d5ee8c789561b134ce40687ad36880ac7a9f3f6c04a2cf |