summaryrefslogtreecommitdiff
path: root/exterminate-jobs-whose-minion-is-lost
diff options
context:
space:
mode:
Diffstat (limited to 'exterminate-jobs-whose-minion-is-lost')
-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