Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_sentry-1.6.0.tar.gz (12.1 kB view hashes)

Uploaded Source

Built Distribution

py_sentry-1.6.0-py3-none-any.whl (18.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page