Skip to content

Commit

Permalink
Fix monitoring emails for failed tasks in OSIDB (#296)
Browse files Browse the repository at this point in the history
This PR introduces two commits which will:

* Actually save the task results in the database in stage & production
* Ensure the pool workers are gevent and psycogreen patched
  • Loading branch information
Elkasitu authored Aug 7, 2023
2 parents 138b2fb + 23a7cce commit d134895
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
11 changes: 11 additions & 0 deletions config/celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,14 @@
@signals.setup_logging.connect
def on_celery_setup_logging(**kwargs):
pass


@signals.worker_process_init.connect
def configure_worker_greenthreads(*args, **kwargs):
from gevent import monkey

monkey.patch_all()

from psycogreen import gevent

gevent.patch_psycopg()
2 changes: 1 addition & 1 deletion config/settings_prod.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
# Celery settings

REDIS_PASSWORD = get_env("OSIDB_REDIS_PASSWORD")
CELERY_BROKER_URL = CELERY_RESULT_BACKEND = f"rediss://:{REDIS_PASSWORD}@redis:6379/"
CELERY_BROKER_URL = f"rediss://:{REDIS_PASSWORD}@redis:6379/"
CELERY_BROKER_USE_SSL = {
"ssl_keyfile": "/opt/app-root/etc/redis/certs/osidb-redis.key",
"ssl_certfile": "/opt/app-root/etc/redis/certs/osidb-redis.crt",
Expand Down
2 changes: 1 addition & 1 deletion config/settings_stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
# Celery settings

REDIS_PASSWORD = get_env("OSIDB_REDIS_PASSWORD")
CELERY_BROKER_URL = CELERY_RESULT_BACKEND = f"rediss://:{REDIS_PASSWORD}@redis:6379/"
CELERY_BROKER_URL = f"rediss://:{REDIS_PASSWORD}@redis:6379/"
CELERY_BROKER_USE_SSL = {
"ssl_keyfile": "/opt/app-root/etc/redis/certs/osidb-redis.key",
"ssl_certfile": "/opt/app-root/etc/redis/certs/osidb-redis.crt",
Expand Down

0 comments on commit d134895

Please sign in to comment.