Skip to content

Commit

Permalink
terminate-shell-pods.ts: standardise cron execution, email on error
Browse files Browse the repository at this point in the history
  • Loading branch information
siddharthvp committed Nov 19, 2022
1 parent d0119c7 commit eb817e1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion crontab
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,4 @@
8 16 * * * jsub -quiet -N gans-list -mem 900m ~/SDZeroBot/job most-gans/gans-lister.js
0 3 1 * * jsub -quiet -N gans-users -mem 1g ~/SDZeroBot/job most-gans/update-usernames.js

0 4 * * * jsub -quiet -N shells -mem 400m ~/SDZeroBot/terminate-shell-pods.js
0 4 * * * jsub -quiet -N shells -mem 400m ~/SDZeroBot/job terminate-shell-pods.js
4 changes: 2 additions & 2 deletions terminate-shell-pods.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {bot, log} from "./botbase";
import {bot, emailOnError, log} from "./botbase";
import {KubeConfig, CoreV1Api} from "@kubernetes/client-node";

(async function () {
Expand All @@ -16,7 +16,7 @@ import {KubeConfig, CoreV1Api} from "@kubernetes/client-node";
await k8sApi.deleteNamespacedPod(podName, namespace);
}
}
})();
})().catch(err => emailOnError(err, 'terminate-shell-pods'));

function isStale(date: Date): boolean {
return new bot.date().subtract(2, 'hours').isAfter(date);
Expand Down

0 comments on commit eb817e1

Please sign in to comment.