bcgov/TheOrgBook

Ensure celery workers aren't checking/running migrations or attempting to update solr

Closed this issue · 1 comments

With autoscaling this could be resource intensive.

Following it the start-up log of a celery worker node. It does not attempt to run database migrations or update Solr. The script controlling the start-up of the celery worker nodes start-celery-worker.sh is executed in the s2i run life-cycle before any migrations are attempted.

The warning about the process being run as a superuser is a bit of a misnomer. The process is being run in the user context of the user account assigned by OpenShift. That account has limited privileges.

---> Running application from script (start-celery-worker.sh) ...
--
  | Starting an instance of the tob-api as a Celery worker node ...
  | Loading custom settings file: custom_settings_bcgov.py
  | INFO 2018-09-07 20:31:21,345 manager 7 140498253715200 Initializing Indy service
  | /home/indy/.pyenv/versions/3.6.3/lib/python3.6/site-packages/celery/platforms.py:796: RuntimeWarning: You're running the worker with superuser privileges: this is
  | absolutely not recommended!
  |  
  | Please specify a different user using the --uid option.
  |  
  | User information: uid=1002700000 euid=1002700000 gid=0 egid=0
  |  
  | uid=uid, euid=euid, gid=gid, egid=egid,
  |  
  | -------------- celery@django-worker-15-5hs9j v4.2.1 (windowlicker)
  | ---- **** -----
  | --- * ***  * -- Linux-3.10.0-862.11.6.el7.x86_64-x86_64-with-debian-stretch-sid 2018-09-07 20:31:21
  | -- * - **** ---
  | - ** ---------- [config]
  | - ** ---------- .> app:         tob_api:0x7fc845fce0f0
  | - ** ---------- .> transport:   amqp://USER_NuR5:**@rabbitmq:5672//
  | - ** ---------- .> results:     disabled://
  | - *** --- * --- .> concurrency: 32 (prefork)
  | -- ******* ---- .> task events: ON
  | --- ***** -----
  | -------------- [queues]
  | .> celery           exchange=celery(direct) key=celery
  |  
  |  
  | [tasks]
  | . api_v2.tasks.process_credential
  | . tob_api.celery.debug_task
  |  
  | [2018-09-07 20:31:32,200: INFO/MainProcess] Connected to amqp://USER_NuR5:**@rabbitmq:5672//
  | [2018-09-07 20:31:32,273: INFO/MainProcess] mingle: searching for neighbors
  | [2018-09-07 20:31:33,301: INFO/MainProcess] mingle: all alone
  | [2018-09-07 20:31:33,320: INFO/MainProcess] celery@django-worker-15-5hs9j ready.