Skip to content

Commit

Permalink
disable daily embed task in development (#2001)
Browse files Browse the repository at this point in the history
* disable celery for local dev

* fix env var for environment
  • Loading branch information
shanbady authored Jan 29, 2025
1 parent 94aefe4 commit f0b1d26
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions main/settings_celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from main.envs import get_bool, get_int, get_string

DEV_ENV = get_bool("DEV_ENV", False) # noqa: FBT003
USE_CELERY = True
CELERY_BROKER_URL = get_string("CELERY_BROKER_URL", get_string("REDISCLOUD_URL", None))
CELERY_RESULT_BACKEND = get_string(
Expand Down Expand Up @@ -130,12 +131,6 @@
"schedule": crontab(minute=30, hour=18), # 2:30pm EST
"kwargs": {"period": "daily", "subscription_type": "channel_subscription_type"},
},
"daily_embed_new_learning_resources": {
"task": "vector_search.tasks.embed_new_learning_resources",
"schedule": get_int(
"EMBED_NEW_RESOURCES_SCHEDULE_SECONDS", 60 * 30
), # default is every 30 minutes
},
"send-search-subscription-emails-every-1-days": {
"task": "learning_resources_search.tasks.send_subscription_emails",
"schedule": crontab(minute=0, hour=19), # 3:00pm EST
Expand All @@ -148,6 +143,14 @@
}


if not DEV_ENV:
CELERY_BEAT_SCHEDULE["daily_embed_new_learning_resources"] = {
"task": "vector_search.tasks.embed_new_learning_resources",
"schedule": get_int(
"EMBED_NEW_RESOURCES_SCHEDULE_SECONDS", 60 * 30
), # default is every 30 minutes
}

CELERY_TASK_SERIALIZER = "json"
CELERY_RESULT_SERIALIZER = "json"
CELERY_ACCEPT_CONTENT = ["json"]
Expand Down

0 comments on commit f0b1d26

Please sign in to comment.