Skip to content

Commit 2c739c3

Browse files
authored
fix: logic cleanup
1 parent f9773fb commit 2c739c3

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

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

+11-11
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,18 @@
44

55
{% set edxapp_venv_bin = edxapp_venv_dir + "/bin" %}
66
source {{ edxapp_app_dir }}/edxapp_env
7+
{% set executable = edxapp_venv_bin + '/celery' %}
8+
79
{% if COMMON_ENABLE_NEWRELIC_APP %}
8-
{% set executable = edxapp_venv_bin + '/newrelic-admin run-program ' + edxapp_venv_bin + '/celery' %}
10+
{% set executable = edxapp_venv_bin + '/newrelic-admin run-program ' + executable %}
11+
12+
export NEW_RELIC_CONFIG_FILE="{{ edxapp_app_dir }}/newrelic.ini"
13+
if command -v ec2metadata >/dev/null 2>&1; then
14+
INSTANCEID=$(ec2metadata --instance-id);
15+
HOSTNAME=$(hostname)
16+
export NEW_RELIC_PROCESS_HOST_DISPLAY_NAME="$HOSTNAME-$INSTANCEID"
17+
fi
18+
{% endif %}
919

1020
{% if COMMON_ENABLE_DATADOG and COMMON_ENABLE_DATADOG_APP %}
1121
{% set executable = edxapp_venv_bin + '/ddtrace-run ' + executable %}
@@ -19,16 +29,6 @@ export DD_TRACE_LOG_STREAM_HANDLER=false
1929
export DD_TRACE_PYMONGO_ENABLED=false
2030
{% endif -%}
2131

22-
export NEW_RELIC_CONFIG_FILE="{{ edxapp_app_dir }}/newrelic.ini"
23-
if command -v ec2metadata >/dev/null 2>&1; then
24-
INSTANCEID=$(ec2metadata --instance-id);
25-
HOSTNAME=$(hostname)
26-
export NEW_RELIC_PROCESS_HOST_DISPLAY_NAME="$HOSTNAME-$INSTANCEID"
27-
fi
28-
{% else %}
29-
{% set executable = edxapp_venv_bin + '/celery' %}
30-
{% endif %}
31-
3232
# We exec so that celery is the child of supervisor and can be managed properly
3333

3434
exec {{ executable }} $@

0 commit comments

Comments
 (0)