Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions codalab/apps/web/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,18 @@ def create_storage_analytics_snapshot():
logger.info("Task create_storage_analytics_snapshot stoped. Duration = {:.3f} seconds".format(elapsed_time))


@task(queue='site-worker')
def reset_computed_storage_analytics():
logger.info("Task reset_computed_storage_analytics started")
starting_time = time.process_time()

# Reset the value of all computed sizes so they will be re-computed again without any shifting on the next run of the storage analytics task
CompetitionSubmission.objects.all().update(sub_size=0)

elapsed_time = time.process_time() - starting_time
logger.info("Task reset_computed_storage_analytics stoped. Duration = {:.3f} seconds".format(elapsed_time))


@task(queue='site-worker')
def do_phase_migrations():
competitions = Competition.objects.filter(is_migrating=False)
Expand Down
4 changes: 4 additions & 0 deletions codalab/codalab/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,10 @@ class Base(Configuration):
'task': 'apps.web.tasks.create_storage_analytics_snapshot',
'schedule': crontab(hour=2, minute=0, day_of_week='sun') # Every Sunday at 02:00
},
'reset_computed_storage_analytics': {
'task': 'apps.web.tasks.reset_computed_storage_analytics',
'schedule': crontab(minute=0, hour=2, day_of_month=1, month_of_year="*/3") # Every 3 month at 02:00 on the 1st
}
}
CELERY_TIMEZONE = 'UTC'

Expand Down