fail jobs if workers die
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Johannes Heuel
2022-10-20 10:03:15 +02:00
parent 949801fc4d
commit 71098b44e6
4 changed files with 44 additions and 12 deletions

View File

@@ -2,8 +2,17 @@
import sys
import requests
from os import environ
resp = requests.post("http://localhost:8080/status", json=[{"id": int(sys.argv[1])}])
def print_and_exit(s):
print(s)
exit(0)
resp = requests.post(
"http://localhost:8080/status",
json=[{"id": int(sys.argv[1])}],
headers={"cookie": environ["ZOIDBERG_SECRET"]},
)
translation = {
"Submitted": "running",
@@ -11,4 +20,12 @@ translation = {
"Failed": "failed",
}
print(translation[resp.json()[0]["status"]])
j = resp.json()
if len(j) == 0:
print_and_exit("failed")
if "Running" in j[0]["status"]:
print_and_exit("running")
print_and_exit(translation[resp.json()[0]["status"]])

View File

@@ -2,6 +2,7 @@
import sys
import requests
from os import environ
jobscript = sys.argv[1]
@@ -10,6 +11,7 @@ resp = requests.post(
json=[
{"cmd": jobscript},
],
headers={"cookie": environ["ZOIDBERG_SECRET"]},
)
assert resp.ok, "http request failed"