Improve k8s logging accuracy
parent
04b01c4e50
commit
a1e58e3e99
|
@ -3309,15 +3309,16 @@ class Kubernetes {
|
|||
while (true) {
|
||||
try {
|
||||
let existsAlready = false;
|
||||
let status;
|
||||
try {
|
||||
const status = yield this.kubeClient.readNamespacedPodStatus(this.podName, this.namespace);
|
||||
status = yield this.kubeClient.readNamespacedPodStatus(this.podName, this.namespace);
|
||||
cloud_runner_logger_1.default.log(JSON.stringify((_a = status.body.status) === null || _a === void 0 ? void 0 : _a.containerStatuses, undefined, 4));
|
||||
existsAlready = true;
|
||||
}
|
||||
catch (_d) {
|
||||
// empty
|
||||
}
|
||||
if (!existsAlready) {
|
||||
if (!existsAlready || status.state.terminated !== undefined) {
|
||||
cloud_runner_logger_1.default.log('Job does not exist');
|
||||
yield this.createNamespacedJob(commands, image, mountdir, workingdir, environment, secrets);
|
||||
const find = yield Kubernetes.findPodFromJob(this.kubeClient, this.jobName, this.namespace);
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -134,14 +134,15 @@ class Kubernetes implements ProviderInterface {
|
|||
while (true) {
|
||||
try {
|
||||
let existsAlready = false;
|
||||
let status;
|
||||
try {
|
||||
const status = await this.kubeClient.readNamespacedPodStatus(this.podName, this.namespace);
|
||||
status = await this.kubeClient.readNamespacedPodStatus(this.podName, this.namespace);
|
||||
CloudRunnerLogger.log(JSON.stringify(status.body.status?.containerStatuses, undefined, 4));
|
||||
existsAlready = true;
|
||||
} catch {
|
||||
// empty
|
||||
}
|
||||
if (!existsAlready) {
|
||||
if (!existsAlready || status.state.terminated !== undefined) {
|
||||
CloudRunnerLogger.log('Job does not exist');
|
||||
await this.createNamespacedJob(commands, image, mountdir, workingdir, environment, secrets);
|
||||
const find = await Kubernetes.findPodFromJob(this.kubeClient, this.jobName, this.namespace);
|
||||
|
|
Loading…
Reference in New Issue