Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

creation of task #3289

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
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