Skip to content

Commit

Permalink
Plug custom Celery tasks via dynamic settings (#3819)
Browse files Browse the repository at this point in the history
* plug custom celery tasks via dynamic settings

* an extra blank line
  • Loading branch information
Omer Lachish authored May 22, 2019
1 parent d97ce15 commit 29875e6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions redash/settings/dynamic_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,13 @@ def query_time_limit(is_scheduled, user_id, org_id):
adhoc_time_limit = int_or_none(os.environ.get('REDASH_ADHOC_QUERY_TIME_LIMIT', None))

return scheduled_time_limit if is_scheduled else adhoc_time_limit


# Provide any custom tasks you'd like to run periodically
def custom_tasks():
return {
# 'key': {
# 'task': 'redash.task.example',
# 'schedule': timedelta(minutes=5)
# }
}
2 changes: 2 additions & 0 deletions redash/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
'schedule': timedelta(minutes=5)
}

celery_schedule.update(settings.dynamic_settings.custom_tasks())

celery.conf.update(result_backend=settings.CELERY_RESULT_BACKEND,
beat_schedule=celery_schedule,
timezone='UTC',
Expand Down

0 comments on commit 29875e6

Please sign in to comment.