summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2014-05-14 10:17:59 +0000
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2014-05-14 10:17:59 +0000
commit3165926a539379901c5735ccfec84f5d0c389965 (patch)
tree277fb3a6c027ececff5d9d5dcc38c1dfeb0a44bc
parentf611e4f3fc044a6cc2bb6c3b1d934c9cc09bad6e (diff)
downloadlorry-controller-3165926a539379901c5735ccfec84f5d0c389965.tar.gz
Add script to terminate jobs (stopgap)
-rw-r--r--exterminate-jobs-whose-minion-is-lost22
1 files changed, 22 insertions, 0 deletions
diff --git a/exterminate-jobs-whose-minion-is-lost b/exterminate-jobs-whose-minion-is-lost
new file mode 100644
index 0000000..4e9ff01
--- /dev/null
+++ b/exterminate-jobs-whose-minion-is-lost
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# Sometimes a MINION dies and never tells WEBAPP that a job is
+# finished. This makes the list of jobs grow to max size, which
+# stops WEBAPP from scheduling more jobs to run. This scripts
+# EXTERMINATEs such jobs. Do NOT run it casually, you MUST check
+# that it is OK to EXTERMINATE the job first. Davros has spoken.
+#
+# This is a STOPGAP until Lorry Controller deals with this
+# automatically.
+
+# Not using -e so that curl failing won't stop things. curl may
+# fail if the job isn't in the expected state. We want to
+# EXTERMINATE it anyway.
+set -u
+
+for jobid in "$@"
+do
+ curl -s -X POST --data "job_id=$jobid" http://localhost:12765/1.0/stop-job
+ curl -s -X POST --data "job_id=$jobid&exit=125&stdout=&stderr=" http://localhost:12765/1.0/job-update
+ curl -s -X POST --data "job_id=$jobid" http://localhost:12765/1.0/remove-job
+done > /dev/null