I have just started to perform some testing for my deployed OTM instance, I noticed that the celeryd service isn't running on my server. Trying to run
python /usr/local/otm/app/opentreemap/manage.py celeryd always returned with an error saying that celeryd was not a valid option in manage.py. I looked in the requirements.txt file and noticed that django-celery isn't included. After some digging, it looks like the installation guide may be out of date.
Looking at the difference between the versions, the most notable is the built-in support for django with celery, which allowed the team to drop the django-celery package, meaning the 'celeryd' option went away from manage.py. The Installation Guide still references using a service calling manage.py, but it seems like the proper way would be to call celery itself with something similar to celery -A opentreemap worker -l info.
Has anyone determined the proper way to start up celery using this new method?
I've tried running celery -A opentreemap -b redis://$BROKER_URL/2 worker -l info, where BROKER_URL is the same value as from the opentreemap/settings/local_settings.py file.
This seems to start celery up fine:
-------------- celery@<hostname> v4.1.0 (latentcall)
---- **** -----
--- * *** * -- Linux-4.4.0-138-generic-x86_64-with-Ubuntu-16.04-xenial 2018-11-25 03:53:45
-- * - **** ---
- ** ---------- [config]
- ** ---------- .> app: opentreemap:0x7f38a1fa6fd0
- ** ---------- .> transport: redis://$BROKER_URL/2
- ** ---------- .> results: redis://$BROKER_URL/
- *** --- * --- .> concurrency: 2 (prefork)
-- ******* ---- .> task events: OFF (enable -E to monitor tasks in this worker)
--- ***** -----
-------------- [queues]
.> Black exchange=Black(direct) key=task.Black
[tasks]
. appevents.tasks.handle_event
. appevents.tasks.queue_events_to_be_handled
. exporter.tasks.async_csv_export
. exporter.tasks.async_users_export
. exporter.tasks.custom_async_csv
. exporter.tasks.simple_async_csv
. importer.tasks._commit_rows
. importer.tasks._finalize_commit
. importer.tasks._finalize_validation
. importer.tasks._validate_rows
. importer.tasks.commit_import_event
. importer.tasks.get_import_export
. importer.tasks.run_import_event_validation
[2018-11-25 03:53:45,374: INFO/MainProcess] Connected to redis://$BROKER_URL/2
[2018-11-25 03:53:45,379: INFO/MainProcess] mingle: searching for neighbors
[2018-11-25 03:53:46,393: INFO/MainProcess] mingle: all alone
[2018-11-25 03:53:46,402: INFO/MainProcess] celery@<hostname> ready.
However, when trying to perform an import or an export through the OTM site, the operation hangs and eventually returns with a 504 gateway timeout error. Using rollbar, I've been able to trace this to the run_import_event_validation function call located at opentreemap/importer/views.py:722. This makes me think that something may be wrong with my celery command parameters.
tail /var/log/syslog shows:Nov 25 05:01:40 otm-web1 gunicorn[901]: [2018-11-25 04:01:40 +0000] [1666] [DEBUG] POST /map/importer/start_import/
Nov 25 05:06:40 otm-web1 gunicorn[901]: [2018-11-25 05:06:40 +0000] [901] [CRITICAL] WORKER TIMEOUT (pid:1666)
Nov 25 05:06:40 otm-web1 gunicorn[901]: [2018-11-25 04:06:40 +0000] [1666] [INFO] Worker exiting (pid: 1666)
Nov 25 05:06:40 otm-web1 gunicorn[901]: [2018-11-25 05:06:40 +0000] [3595] [INFO] Booting worker with pid: 3595
Any advice is appreciated!
Regards
Chris Ward