Skip to main content

A package to provide useful functionality for sending alerts about running simulations.

Project description

simulert

A package for generating alerts about simulations.

Installation

This project has not made it to Pypi so installation will require cloning the repository and adding it as a development package with either pip install -e /path/to/simulert or conda develop /path/to/simulert.

Usage

This package is architected similarly to Python's built-in logging package. An Alerter class is instantiated with getAlerter and this class is triggered to send alerts which are distributed to all the handlers registered with that class.

Current handlers include a logger (default), an emailer and a slack client.

The Alerter currently provides two ways to trigger alerts: most simply,calling the alert method with a message; and possibly more conveniently, with the simulation_alert context wrapping the simulation code.

Example

from simulert import getAlerter
from simulert.handlers import Emailer, Slacker

emailer = Emailer(
    "username",
    "password",
    ("Simulations", "noreply_simulations@company.com"),
    ("Data scientist", "scientist@company.com"),
    "smtp.mailserver.company.com",
)
slacker = Slacker("slack_app_token", "username")
alerter = getAlerter().add_handler(emailer).add_handler(slacker)
with alerter.simulation_alert("super dooper sim"):
    run_simulation()

TODO

  1. Complete docstrings
  2. Test email.py, logs.py and slack.py
  3. Add default handler args that read environment variables
  4. Write a better README.md
  5. Tidy up pyproject.toml to include only necessary files
  6. Setup Github
    1. Automated testing
    2. Branch protection
  7. Deploy to Pypi via github with version management
  8. Add a changelog
  9. Add a logging handler as an event source.

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

simulert-0.1.0.tar.gz (9.7 kB view hashes)

Uploaded Source

Built Distribution

simulert-0.1.0-py3-none-any.whl (15.2 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