-
Notifications
You must be signed in to change notification settings - Fork 336
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
record CountedUsage in a celery task
- Loading branch information
Showing
3 changed files
with
26 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from framework.celery_tasks import app as celery_app | ||
from osf.metrics.counted_usage import CountedUsage | ||
|
||
|
||
@celery_app.task(bind=True, max_retries=5, default_retry_delay=60) | ||
def record_counted_usage(self, record_kwargs): | ||
try: | ||
CountedUsage.record(**record_kwargs) | ||
except Exception as exc: | ||
self.retry(exc=exc) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters