Commit 385273fd by Fred Smith

add workers wrapper script

parent 6d51d69c
......@@ -330,6 +330,7 @@
with_items:
- "lms.sh"
- "cms.sh"
- "worker.sh"
tags:
- install
- install:configuration
......
......@@ -12,7 +12,7 @@
{% if COMMON_ENABLE_NEWRELIC_APP %}
export NEW_RELIC_APP_NAME="{{ EDXAPP_NEWRELIC_CMS_APPNAME }}"
export NEW_RELIC_CONFIG_FILE="{{ edxapp_app_dir }}/newrelic.ini",
export NEW_RELIC_CONFIG_FILE="{{ edxapp_app_dir }}/newrelic.ini"
if command -v ec2metadata >/dev/null 2>&1; then
INSTANCEID=$(ec2metadata --instance-id);
HOSTNAME=$(hostname)
......
......@@ -12,7 +12,7 @@
{% if COMMON_ENABLE_NEWRELIC_APP %}
export NEW_RELIC_APP_NAME="{{ EDXAPP_NEWRELIC_LMS_APPNAME }}"
export NEW_RELIC_CONFIG_FILE="{{ edxapp_app_dir }}/newrelic.ini",
export NEW_RELIC_CONFIG_FILE="{{ edxapp_app_dir }}/newrelic.ini"
if command -v ec2metadata >/dev/null 2>&1; then
INSTANCEID=$(ec2metadata --instance-id);
HOSTNAME=$(hostname)
......
#!/usr/bin/env bash
# {{ ansible_managed }}
{% set edxapp_venv_bin = edxapp_venv_dir + "/bin" %}
{% if COMMON_ENABLE_NEWRELIC_APP %}
{% set executable = edxapp_venv_bin + '/newrelic-admin run-program ' + edxapp_venv_bin + '/python' %}
{% else %}
{% set executable = edxapp_venv_bin + '/python' %}
{% endif %}
{% if COMMON_ENABLE_NEWRELIC_APP %}
export NEW_RELIC_CONFIG_FILE="{{ edxapp_app_dir }}/newrelic.ini"
if command -v ec2metadata >/dev/null 2>&1; then
INSTANCEID=$(ec2metadata --instance-id);
HOSTNAME=$(hostname)
export NEW_RELIC_PROCESS_HOST_DISPLAY_NAME="$HOSTNAME-$INSTANCEID"
fi
{% endif -%}
{{ executable }} {{ edxapp_code_dir }}/manage.py $@
......@@ -7,7 +7,7 @@ directory={{ edxapp_code_dir }}
stdout_logfile={{ supervisor_log_dir }}/%(program_name)s-stdout.log
stderr_logfile={{ supervisor_log_dir }}/%(program_name)s-stderr.log
command={% if COMMON_ENABLE_NEWRELIC_APP %}NEW_RELIC_PROCESS_HOST_DISPLAY_NAME=`hostname`-`ec2metadata --instance-id`;{% endif -%}{{ edxapp_venv_dir + '/bin/newrelic-admin run-program ' if w.monitor and COMMON_ENABLE_NEWRELIC_APP else ''}}{{ edxapp_venv_bin }}/python {{ edxapp_code_dir }}/manage.py {{ w.service_variant }} --settings={{ worker_django_settings_module }} celery worker --loglevel=info --queues=edx.{{ w.service_variant }}.core.{{ w.queue }} --hostname=edx.{{ w.service_variant }}.core.{{ w.queue }}.%%h --concurrency={{ w.concurrency }} {{ '--maxtasksperchild ' + w.max_tasks_per_child|string if w.max_tasks_per_child is defined else '' }}
command={{ edxapp_app_dir }}/worker.sh {{ w.service_variant }} --settings={{ worker_django_settings_module }} celery worker --loglevel=info --queues=edx.{{ w.service_variant }}.core.{{ w.queue }} --hostname=edx.{{ w.service_variant }}.core.{{ w.queue }}.%%h --concurrency={{ w.concurrency }} {{ '--maxtasksperchild ' + w.max_tasks_per_child|string if w.max_tasks_per_child is defined else '' }}
killasgroup=true
stopwaitsecs={{ w.stopwaitsecs | default(EDXAPP_WORKER_DEFAULT_STOPWAITSECS) }}
; Set autorestart to `true`. The default value for autorestart is `unexpected`, but celery < 4.x will exit
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment