Skip to content
Snippets Groups Projects
Commit 8cba86e4 authored by Jason Hiser's avatar Jason Hiser :tractor:
Browse files

updated thanos to deal with timing, etc. for logs.

Former-commit-id: 2b21dddcf0db2ece286bf5949ed93e7446bee9da
parent b1e1c444
No related branches found
No related tags found
No related merge requests found
...@@ -601,18 +601,20 @@ perform_step() ...@@ -601,18 +601,20 @@ perform_step()
fi fi
fi fi
echo -n Performing step "$step" [dependencies=$mandatory] ...
starttime=`$PS_DATE` starttime=`$PS_DATE`
# If verbose is on, tee to a file # If verbose is on, tee to a file
if [[ ! -z "$DEBUG_STEPS" ]]; then if [[ ! -z "$DEBUG_STEPS" ]]; then
echo -n Performing step "$step" [dependencies=$mandatory] ...
eval $command eval $command
command_exit=$? command_exit=$?
elif [[ ! -z "$VERBOSE" && $using_thanos -eq 0 ]]; then elif [[ ! -z "$VERBOSE" && $using_thanos -eq 0 ]]; then
echo -n Performing step "$step" [dependencies=$mandatory] ...
eval $command 2>&1 | tee $logfile eval $command 2>&1 | tee $logfile
command_exit=${PIPESTATUS[0]} # this funkiness gets the exit code of $command, not tee command_exit=${PIPESTATUS[0]} # this funkiness gets the exit code of $command, not tee
elif [[ ! -z "$VERBOSE" && $using_thanos -ne 0 ]]; then elif [[ ! -z "$VERBOSE" && $using_thanos -ne 0 ]]; then
echo -n Performing step "$step" [dependencies=$mandatory] ...
eval $command > $logfile 2>&1 eval $command > $logfile 2>&1
# display logs to stdout # display logs to stdout
for this_step in $step for this_step in $step
...@@ -620,7 +622,11 @@ perform_step() ...@@ -620,7 +622,11 @@ perform_step()
cat logs/$this_step.log cat logs/$this_step.log
done done
cat $logfile cat $logfile
elif [[ $using_thanos -ne 0 ]]; then
eval $command
command_exit=$?
else else
echo -n Performing step "$step" [dependencies=$mandatory] ...
eval $command > $logfile 2>&1 eval $command > $logfile 2>&1
command_exit=$? command_exit=$?
fi fi
...@@ -645,31 +651,33 @@ perform_step() ...@@ -645,31 +651,33 @@ perform_step()
fi fi
fi fi
is_step_error $step $command_exit if [[ $using_thanos -eq 0 ]]; then
if [[ $? -ne 0 ]]; then is_step_error $step $command_exit
echo "Done. Command failed! ***************************************" if [[ $? -ne 0 ]]; then
echo "Done. Command failed! ***************************************"
# check if we need to exit
stop_if_error $step # check if we need to exit
if [ $? -gt $error_threshold ]; then stop_if_error $step
echo The $step step is necessary, but failed. Exiting ps_analyze early. if [ $? -gt $error_threshold ]; then
exit -1; echo The $step step is necessary, but failed. Exiting ps_analyze early.
exit -1;
fi
errors=1
elif [ -f warning.txt ]; then
# report warning to user.
warnings=1
echo "Done. Command had serious warnings! ***************************************"
cat warning.txt
# report warning in log file, line by line, as an attribute.
while IFS= read -r line; do
echo
echo "#ATTRIBUTE serious_warning_text=\"$line\"" >> $logfile
done < "warning.txt"
# remove warning.txt so we don't report these warnings again.
rm -f warning.txt
else
echo "Done. Successful."
fi fi
errors=1
elif [ -f warning.txt ]; then
# report warning to user.
warnings=1
echo "Done. Command had serious warnings! ***************************************"
cat warning.txt
# report warning in log file, line by line, as an attribute.
while IFS= read -r line; do
echo
echo "#ATTRIBUTE serious_warning_text=\"$line\"" >> $logfile
done < "warning.txt"
# remove warning.txt so we don't report these warnings again.
rm -f warning.txt
else
echo Done. Successful.
fi fi
# move to the next step # move to the next step
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment