Skip to content
Snippets Groups Projects
Commit e86a26ea authored by Henryk Blasinski's avatar Henryk Blasinski
Browse files

Cleanup job existence bug fix.

parent 27b5c68d
No related branches found
No related tags found
No related merge requests found
...@@ -62,14 +62,14 @@ system(cmd); ...@@ -62,14 +62,14 @@ system(cmd);
% resources (disk space, memory). We are going to run a simple service that % resources (disk space, memory). We are going to run a simple service that
% periodically lists all succesfully completed jobs and removes them from % periodically lists all succesfully completed jobs and removes them from
% the engine. % the engine.
namespace = hints.batchRenderStraregy.renderer.kubectlNamespace; namespace = hints.batchRenderStrategy.renderer.kubectlNamespace;
cmd = sprintf('kubectl get jobs --namespace=%s | grep cleanup',namespace); cmd = sprintf('kubectl get jobs --namespace=%s | grep cleanup',namespace);
[~, result] = system(cmd); [~, result] = system(cmd);
if isempty(strfind(result,'cleanup')) if isempty(strfind(result,'cleanup'))
cmd = sprintf('kubectl run cleanup --limits cpu=500m --restart=OnFailure --image=google/cloud-sdk -- /bin/bash -c ''while true; do echo "Starting"; kubectl delete jobs --namespace=%s $(kubectl get jobs --namespace=%s | awk ''"''"''$3=="1" {print $1}''"''"''); echo "Deleted jobs"; sleep 30; done''',... cmd = sprintf('kubectl run cleanup --limits cpu=500m --namespace=%s --restart=OnFailure --image=google/cloud-sdk -- /bin/bash -c ''while true; do echo "Starting"; kubectl delete jobs --namespace=%s $(kubectl get jobs --namespace=%s | awk ''"''"''$3=="1" {print $1}''"''"''); echo "Deleted jobs"; sleep 30; done''',...
namespace,namespace); namespace,namespace,namespace);
system(cmd); system(cmd);
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment