-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
374 changed files
with
20,878 additions
and
13,165 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
pods=$(kubectl get pods -l app=loculus -n loculus -o jsonpath='{.items[*].metadata.name}' || true) | ||
for pod in $pods; do | ||
containers=$(kubectl get pod "$pod" -n loculus -o jsonpath='{.spec.containers[*].name}' || true) | ||
for container in $containers; do | ||
mkdir "kubernetes_logs" -p | ||
file="kubernetes_logs/$pod-$container.txt" | ||
echo "Logs from $pod - $container:" >> "$file" | ||
kubectl logs "$pod" -n loculus -c "$container" >> "$file" 2>/dev/null || true | ||
done | ||
done |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import json | ||
import subprocess | ||
import time | ||
|
||
|
||
def main(): | ||
end_time = time.time() + 480 | ||
|
||
while True: | ||
pods = get_pods() | ||
|
||
if time.time() > end_time: | ||
print("Aborting, timeout reached") | ||
exit(1) | ||
|
||
try: | ||
if all_pods_are_ready(pods): | ||
print("All pods are up and running!") | ||
break | ||
except KeyError as e: | ||
print("KeyError:", e, "continuing...") | ||
|
||
print("Sleeping for 10 seconds...") | ||
time.sleep(10) | ||
|
||
|
||
def get_pods(): | ||
cmd = ['kubectl', 'get', 'pods', '-l', 'app=loculus', '-n', 'loculus', '-o', 'json'] | ||
result = subprocess.run(cmd, capture_output=True, text=True) | ||
return json.loads(result.stdout)['items'] | ||
|
||
|
||
def all_pods_are_ready(pods): | ||
for pod in pods: | ||
print("Status of:", pod['metadata']['name'], "-", pod['status']['phase']) | ||
if pod['status']['phase'] == 'Succeeded': | ||
continue | ||
if has_container_that_is_not_ready(pod): | ||
return False | ||
return True | ||
|
||
|
||
def has_container_that_is_not_ready(pod): | ||
for container_status in pod['status']['containerStatuses']: | ||
if container_status['ready'] is False: | ||
print(container_status['name'], "is not ready") | ||
return True | ||
return False | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.