mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 07:35:34 -05:00
create cronitor decorator that alerts if tasks fail
make a decorator that pings cronitor before and after each task run. Designed for use with nightly tasks, so we have visibility if they fail. We have a bunch of cronitor monitors set up - 5 character keys that go into a URL that we then make a GET to with a self-explanatory url path (run/fail/complete). the cronitor URLs are defined in the credentials repo as a dictionary of celery task names to URL slugs. If the name passed in to the decorator isn't in that dict, it won't run. to use it, all you need to do is call `@cronitor(my_task_name)` instead of `@notify_celery.task`, and make sure that the task name and the matching slug are included in the credentials repo (or locally, json dumped and stored in the CRONITOR_KEYS environment variable)
This commit is contained in:
@@ -20,10 +20,6 @@ from app import db
|
||||
from tests.app.db import create_service, create_template, create_notification
|
||||
|
||||
|
||||
def test_reporting_should_have_decorated_tasks_functions():
|
||||
assert create_nightly_billing.__wrapped__.__name__ == 'create_nightly_billing'
|
||||
|
||||
|
||||
def mocker_get_rate(
|
||||
non_letter_rates, letter_rates, notification_type, date, crown=None, rate_multiplier=None, post_class="second"
|
||||
):
|
||||
|
||||
Reference in New Issue
Block a user