Skip to content

Commit db93f80

Browse files
authored
fix: variable reference syntax (edx#12)
* fix: variable reference syntax * fix: merge/incorporate old commits
1 parent ee5d9a3 commit db93f80

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

playbooks/roles/edxapp/templates/edx/app/edxapp/worker.sh.j2

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,31 @@
44

55
{% set edxapp_venv_bin = edxapp_venv_dir + "/bin" %}
66
source {{ edxapp_app_dir }}/edxapp_env
7+
{% set executable = edxapp_venv_bin + '/celery' %}
78
{% if COMMON_ENABLE_NEWRELIC_APP %}
8-
{% set executable = edxapp_venv_bin + '/newrelic-admin run-program ' + edxapp_venv_bin + '/celery' %}
9+
{% set executable = edxapp_venv_bin + '/newrelic-admin run-program ' + executable %}
910

1011
export NEW_RELIC_CONFIG_FILE="{{ edxapp_app_dir }}/newrelic.ini"
1112
if command -v ec2metadata >/dev/null 2>&1; then
1213
INSTANCEID=$(ec2metadata --instance-id);
1314
HOSTNAME=$(hostname)
1415
export NEW_RELIC_PROCESS_HOST_DISPLAY_NAME="$HOSTNAME-$INSTANCEID"
1516
fi
16-
{% else %}
17-
{% set executable = edxapp_venv_bin + '/celery' %}
1817
{% endif %}
1918

19+
{% if EDXAPP_DATADOG_ENABLE %}
20+
{% set executable = edxapp_venv_bin + '/ddtrace-run ' + executable %}
21+
export DD_TAGS="service:edx-edxapp-workers-${SERVICE_VARIANT},queue:${QUEUE_NAME}"
22+
export DD_DJANGO_USE_LEGACY_RESOURCE_FORMAT=true
23+
# Copied from edx_django_service playbook for consistency; Datadog
24+
# trace debug logging issue doesn't actually affect edxapp for some
25+
# reason.
26+
export DD_TRACE_LOG_STREAM_HANDLER=false
27+
# Datadog's instrumentation breaks pymongo: https://github.com/edx/edx-arch-experiments/issues/580
28+
export DD_TRACE_PYMONGO_ENABLED=false
29+
{% endif -%}
30+
31+
2032
# We exec so that celery is the child of supervisor and can be managed properly
2133

2234
exec {{ executable }} $@

playbooks/roles/edxapp/templates/edx/app/supervisor/conf.d.available/workers.conf.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{% for w in edxapp_workers %}
22
[program:{{ w.service_variant }}_{{ w.queue }}_{{ w.concurrency }}]
33

4-
environment={% if COMMON_ENABLE_NEWRELIC_APP %}NEW_RELIC_APP_NAME={{ EDXAPP_NEWRELIC_WORKERS_APPNAME }}-{{ w.service_variant }},NEW_RELIC_DISTRIBUTED_TRACING_ENABLED={{ EDXAPP_WORKERS_ENABLE_NEWRELIC_DISTRIBUTED_TRACING }},NEW_RELIC_LICENSE_KEY={{ NEWRELIC_LICENSE_KEY }},{% endif -%}CONCURRENCY={{ w.concurrency }},LOGLEVEL=info,DJANGO_SETTINGS_MODULE={{ w.service_variant }}.envs.{{ worker_django_settings_module }},LANG={{ EDXAPP_LANG }},PYTHONPATH={{ edxapp_code_dir }},SERVICE_VARIANT={{ w.service_variant }},BOTO_CONFIG="{{ edxapp_app_dir }}/.boto",EDX_REST_API_CLIENT_NAME=edx.{{ w.service_variant }}.core.{{ w.queue }}
4+
environment={% if COMMON_ENABLE_NEWRELIC_APP %}NEW_RELIC_APP_NAME={{ EDXAPP_NEWRELIC_WORKERS_APPNAME }}-{{ w.service_variant }},NEW_RELIC_DISTRIBUTED_TRACING_ENABLED={{ EDXAPP_WORKERS_ENABLE_NEWRELIC_DISTRIBUTED_TRACING }},NEW_RELIC_LICENSE_KEY={{ NEWRELIC_LICENSE_KEY }},{% endif -%}CONCURRENCY={{ w.concurrency }},LOGLEVEL=info,DJANGO_SETTINGS_MODULE={{ w.service_variant }}.envs.{{ worker_django_settings_module }},LANG={{ EDXAPP_LANG }},PYTHONPATH={{ edxapp_code_dir }},SERVICE_VARIANT={{ w.service_variant }},BOTO_CONFIG="{{ edxapp_app_dir }}/.boto",EDX_REST_API_CLIENT_NAME=edx.{{ w.service_variant }}.core.{{ w.queue }},QUEUE_NAME={{ w.service_variant }}.core.{{ w.queue }}
55
user={{ common_web_user }}
66
directory={{ edxapp_code_dir }}
77
stdout_logfile={{ supervisor_log_dir }}/%(program_name)s-stdout.log

0 commit comments

Comments
 (0)