allow you to pass in date to send perf stats

make it easier to replay sending data for a day if it failed the first
time round
This commit is contained in:
Leo Hemsted
2019-06-11 13:57:17 +01:00
parent d19dbe5b61
commit 5045590d75
3 changed files with 17 additions and 12 deletions

View File

@@ -150,11 +150,17 @@ def timeout_notifications():
@notify_celery.task(name='send-daily-performance-platform-stats')
@cronitor('send-daily-performance-platform-stats')
@statsd(namespace="tasks")
def send_daily_performance_platform_stats():
def send_daily_performance_platform_stats(date=None):
# date is a string in the format of "YYYY-MM-DD"
if date is None:
date = (datetime.utcnow() - timedelta(days=1)).date()
else:
date = datetime.strptime(date, "%Y-%m-%d").date()
if performance_platform_client.active:
yesterday = datetime.utcnow() - timedelta(days=1)
send_total_sent_notifications_to_performance_platform(bst_date=yesterday.date())
processing_time.send_processing_time_to_performance_platform()
send_total_sent_notifications_to_performance_platform(bst_date=date)
processing_time.send_processing_time_to_performance_platform(bst_date=date)
def send_total_sent_notifications_to_performance_platform(bst_date):