mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-16 10:12:32 -05:00
Add import report_tasks to schedule_tasks.
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
from app import notify_celery
|
|
||||||
from notifications_utils.statsd_decorators import statsd
|
|
||||||
import random
|
import random
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from app.models import (Notification,
|
from app.models import (Notification,
|
||||||
@@ -14,6 +12,8 @@ from app.models import (Notification,
|
|||||||
from app import db
|
from app import db
|
||||||
from sqlalchemy import func, desc, case
|
from sqlalchemy import func, desc, case
|
||||||
from app.dao.dao_utils import transactional
|
from app.dao.dao_utils import transactional
|
||||||
|
from notifications_utils.statsd_decorators import statsd
|
||||||
|
from app import notify_celery
|
||||||
|
|
||||||
|
|
||||||
def get_rate(non_letter_rates, letter_rates, notification_type, date, crown=None, rate_multiplier=None):
|
def get_rate(non_letter_rates, letter_rates, notification_type, date, crown=None, rate_multiplier=None):
|
||||||
@@ -26,10 +26,10 @@ def get_rate(non_letter_rates, letter_rates, notification_type, date, crown=None
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
@notify_celery.task(bind=True, name="create-nightly-billing", max_retries=15, default_retry_delay=300)
|
@notify_celery.task(name="create-nightly-billing")
|
||||||
@statsd(namespace="tasks")
|
@statsd(namespace="tasks")
|
||||||
@transactional
|
@transactional
|
||||||
def create_nightly_billing(self, day_start=None):
|
def create_nightly_billing(day_start=None):
|
||||||
if day_start is None:
|
if day_start is None:
|
||||||
day_start = datetime.date(datetime.utcnow()) - timedelta(days=3) # Nightly jobs consolidating last 3 days
|
day_start = datetime.date(datetime.utcnow()) - timedelta(days=3) # Nightly jobs consolidating last 3 days
|
||||||
# Task to be run after mid-night
|
# Task to be run after mid-night
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ from app.celery.service_callback_tasks import (
|
|||||||
create_encrypted_callback_data,
|
create_encrypted_callback_data,
|
||||||
)
|
)
|
||||||
import pytz
|
import pytz
|
||||||
|
from app.celery.reporting_tasks import create_nightly_billing # noqa - otherwise task won't start
|
||||||
|
|
||||||
|
|
||||||
@worker_process_shutdown.connect
|
@worker_process_shutdown.connect
|
||||||
|
|||||||
Reference in New Issue
Block a user