Skip to content

Commit

Permalink
Merge pull request #17 from onaio/set-celery-config
Browse files Browse the repository at this point in the history
Set celery config
  • Loading branch information
ivermac authored Aug 21, 2020
2 parents ce44062 + a5147ff commit e3ab663
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 15 deletions.
8 changes: 5 additions & 3 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ kpi_python_version: "python2.7"
kpi_checkout_path: "{{ kpi_versioned_path }}/{{ kpi_git_branch }}"
kpi_app_path: "{{ kpi_system_user_home }}/app"
kpi_versioned_path: "{{ kpi_app_path }}-versioned"
kpi_git_branch: master
kpi_git_branch: ona-custom-changes
kpi_service_name: "{{ kpi_system_user }}"
kpi_venv_path: "{{ kpi_system_user_home }}/.virtualenvs/{{ kpi_service_name }}"
kpi_nvm_install_path: "{{ kpi_system_user_home }}/.nvm"
Expand Down Expand Up @@ -102,12 +102,14 @@ kpi_collectd_scripts:
- unixsock
kpi_monit_scripts:
- uwsgi
kpi_celery_app: "kpi.kpi_celery:app"
kpi_celery_app: "kobo"
kpi_celeryd_opts: "--exclude-queues=sync_kobocat_xforms_queue"
kpi_django_pip_packages:
- uwsgi
- PyJWT==1.4.0

kpi_django_enable_celery: false
kpi_django_enable_celery: true
kpi_django_manage_services: true
kpi_uwsgi_total_memory_limit: 1024

kpi_raven_dsn: ""
Expand Down
7 changes: 1 addition & 6 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
---
- name: restart_service
service:
name: "{{ kpi_service_name }}"
state: restarted
enabled: true
---
3 changes: 2 additions & 1 deletion meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,18 @@ dependencies:
django_wsgi_env: "{{ kpi_wsgi_env }}"
django_wsgi_enable_threads: "{{ kpi_wsgi_enable_threads }}"
django_celery_app: "{{ kpi_celery_app }}"
django_celeryd_opts: "{{ kpi_celeryd_opts }}"
django_apt_python_ppa: "{{ kpi_django_apt_python_ppa }}"
django_pip_paths: "{{ kpi_pip_paths }}"
django_pip_packages: "{{ kpi_django_pip_packages }}"
django_enable_celery: "{{ kpi_django_enable_celery }}"
django_venv_path: "{{ kpi_venv_path }}"
django_pid_socks_dir: "{{ kpi_pid_socket_dir }}"
django_pid_file: "{{ kpi_pid_file }}"
django_wsgi_socket: "{{ kpi_socket_file }}"
django_service_group: "{{ kpi_service_group }}"
django_wsgi_group: "{{ kpi_wsgi_group }}"
django_python_packages: "{{ kpi_python_packages }}"
django_manage_services: "{{ kpi_django_manage_services }}"

- role: onaio.collectd
collectd_scripts: "{{ kpi_collectd_scripts }}"
Expand Down
8 changes: 6 additions & 2 deletions molecule/default/tests/vagranttest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,20 @@
django_apt_python_ppa: "{{ kpi_django_apt_python_ppa }}"
django_pip_paths: "{{ kpi_pip_paths }}"
django_pip_packages: "{{ kpi_django_pip_packages }}"
django_enable_celery: "{{ kpi_django_enable_celery }}"
django_venv_path: "{{ kpi_venv_path }}"
django_pid_socks_dir: "{{ kpi_pid_socket_dir }}"
django_pid_file: "{{ kpi_pid_file }}"
django_wsgi_socket: "{{ kpi_socket_file }}"
django_service_group: "{{ kpi_service_group }}"
django_wsgi_group: "{{ kpi_wsgi_group }}"
django_celeryd_opts: "{{ kpi_celeryd_opts }}"
django_manage_services: "{{ kpi_django_manage_services }}"


gather_facts: true
become: true
roles:
- name: "kpi"
role: ../..
role: ../../../..
vars:
kpi_enable_monitoring: false
6 changes: 3 additions & 3 deletions templates/kpi/settings.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ ENKETO_SURVEY_ENDPOINT = 'api/v2/survey/all'

CELERY_TIMEZONE = "UTC"

CELERY_TASK_ALWAYS_EAGER = True
CELERY_TASK_ALWAYS_EAGER = False
# if os.environ.get('SKIP_CELERY', 'False') == 'True':
# # helpful for certain debugging
# CELERY_TASK_ALWAYS_EAGER = True
Expand Down Expand Up @@ -496,7 +496,7 @@ CELERY_BROKER_TRANSPORT_OPTIONS = {
"visibility_timeout": 60 * (10 ** 3) # Longest ETA for RestService
}

CELERY_TASK_DEFAULT_QUEUE = "kpi_queue"
CELERY_DEFAULT_QUEUE = "kpi_queue"

if 'KOBOCAT_URL' in os.environ:
SYNC_KOBOCAT_XFORMS = (os.environ.get('SYNC_KOBOCAT_XFORMS', 'True') == 'True')
Expand All @@ -521,7 +521,7 @@ RabbitMQ queue creation:
rabbitmqctl set_permissions -p kpi kpi '.*' '.*' '.*'
See http://celery.readthedocs.org/en/latest/getting-started/brokers/rabbitmq.html#setting-up-rabbitmq.
'''
CELERY_BROKER_URL = os.environ.get('KPI_BROKER_URL', 'redis://localhost:6379/1')
BROKER_URL = os.environ.get('KPI_BROKER_URL', '{{ kpi_broker_url }}')

# http://django-registration-redux.readthedocs.org/en/latest/quickstart.html#settings
ACCOUNT_ACTIVATION_DAYS = 3
Expand Down

0 comments on commit e3ab663

Please sign in to comment.