Skip to content

Commit

Permalink
HPCC-30413 Add option to always capture post-mortem info
Browse files Browse the repository at this point in the history
Enabled either globally (i.e. for all components), or for
individual components (e.g. Thor).
Usage:

expert:
  alwaysPostMortem: true

Signed-off-by: Jake Smith <[email protected]>
  • Loading branch information
jakesmith committed Oct 4, 2023
1 parent 9218e73 commit df794a0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
15 changes: 14 additions & 1 deletion helm/hpcc/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,12 @@ Add extra args for a component
{{- $debugPlane := .me.debugPlane | default (include "hpcc.getFirstPlaneForCategory" (dict "root" .root "category" "debug")) -}}
{{- include "hpcc.checkPlaneExists" (dict "root" .root "planeName" $debugPlane) -}}
{{- $prefix := include "hpcc.getPlanePrefix" (dict "root" .root "planeName" $debugPlane) -}}
{{- $meExpert := .me.expert | default dict -}}
{{- $globalExpert := .root.Values.global.expert | default dict -}}
{{- $alwaysPostMortem := (hasKey $meExpert "alwaysPostMortem") | ternary $meExpert.alwaysPostMortem ($globalExpert.alwaysPostMortem | default false) -}}
{{- if $alwaysPostMortem -}}
"-a",{{ "\n" }}
{{- end -}}
"-d", {{ $prefix }},
"--",
{{ .process | quote }},
Expand Down Expand Up @@ -1670,7 +1676,14 @@ args:
{{- $debugPlane := .me.debugPlane | default (include "hpcc.getFirstPlaneForCategory" (dict "root" .root "category" "debug")) -}}
{{- include "hpcc.checkPlaneExists" (dict "root" .root "planeName" $debugPlane) -}}
{{- $prefix := include "hpcc.getPlanePrefix" (dict "root" .root "planeName" $debugPlane) -}}
{{- $_ := set $check_cmd "command" (printf "check_executes -d %s -- %s" $prefix .command) -}}
{{- $pmd_always_opt := "" -}}
{{- $globalExpert := .root.Values.global.expert | default dict -}}
{{- $meExpert := .me.expert | default dict -}}
{{- $alwaysPostMortem := (hasKey $meExpert "alwaysPostMortem") | ternary $meExpert.alwaysPostMortem ($globalExpert.alwaysPostMortem | default false) -}}
{{- if $alwaysPostMortem -}}
{{- $pmd_always_opt = "-a " -}}
{{- end -}}
{{- $_ := set $check_cmd "command" (printf "check_executes %s-d %s -- %s" $pmd_always_opt $prefix .command) -}}
{{- end }}
- >-
{{ $check_cmd.command }};
Expand Down
5 changes: 4 additions & 1 deletion initfiles/bin/check_executes
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ PMD_PROGNAME=
PMD_COPYFILES=()
PMD_DALISERVER=
PMD_WORKUNIT=
PMD_ALWAYS=false

while [ "$#" -gt 0 ]; do
arg=$1
Expand All @@ -27,6 +28,8 @@ while [ "$#" -gt 0 ]; do
f) shift;
PMD_COPYFILES+=($1)
;;
a) PMD_ALWAYS=true
;;
*) usage
exit
;;
Expand Down Expand Up @@ -66,7 +69,7 @@ ${PMD_PROGNAME} --logging.postMortem=1000 "$@"

# If it did not exit cleanly, copy some post-mortem info
retVal=$?
if [ $retVal -ne 0 ]; then
if [ $PMD_ALWAYS = true ] || [ $retVal -ne 0 ]; then
POST_MORTEM_DIR=${PMD_DIRECTORYBASE}/$(hostname)/$(date -Iseconds)
mkdir -p ${POST_MORTEM_DIR}
echo "Post-mortem info gathered in $POST_MORTEM_DIR"
Expand Down

0 comments on commit df794a0

Please sign in to comment.