Asher has submitted this change and it was merged.
Change subject: Factored the exit trap into a function.
......................................................................
Factored the exit trap into a function.
Change-Id: Ie97da247441082e753024c3183465c1d62c05f24
---
M modules/mediawiki/templates/jobrunner/jobs-loop.sh.erb
1 file changed, 12 insertions(+), 2 deletions(-)
Approvals:
Asher: Verified; Looks good to me, approved
jenkins-bot: Verified
diff --git a/modules/mediawiki/templates/jobrunner/jobs-loop.sh.erb
b/modules/mediawiki/templates/jobrunner/jobs-loop.sh.erb
index 126d656..6c2426e 100755
--- a/modules/mediawiki/templates/jobrunner/jobs-loop.sh.erb
+++ b/modules/mediawiki/templates/jobrunner/jobs-loop.sh.erb
@@ -79,6 +79,16 @@
ulimit -v $maxvirtualmemory
fi
+# Function to also get rid of the child processes.
+# This function can be used as a SIGINT trap callback.
+function terminateProcessPipeline() {
+ local pids=$(jobs -pr);
+ if [ -n "$pids" ]; then
+ kill $pids
+ fi
+ exit
+}
+
# Limit the number of concurrent sub-processes by waiting until the
# number of immediate child processes is less than the allowed limit.
# Arguments: (process pipeline size)
@@ -104,7 +114,7 @@
# Arguments: (space-separated job types, run default jobs? (y/n), process
pipeline size)
function runJobsLoopService() {
# When killed, make sure we also get rid of the child processes
- trap 'pids=$(jobs -pr); if [ -n "$pids" ]; then kill $pids; fi; exit'
SIGTERM
+ trap 'terminateProcessPipeline' SIGTERM
local hptypes=$1
local dodefault=$2
@@ -184,7 +194,7 @@
cd `readlink -f /usr/local/apache/common/multiversion`
# When killed, make sure we also get rid of the child processes
-trap 'pids=$(jobs -pr); if [ -n "$pids" ]; then kill $pids; fi; exit' SIGTERM
SIGINT
+trap 'terminateProcessPipeline' SIGTERM SIGINT
if [ -n "$1" ]; then
echo "Creating type-specific job runner pipeline"
--
To view, visit https://gerrit.wikimedia.org/r/68016
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie97da247441082e753024c3183465c1d62c05f24
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Asher <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits