Improve k8s logging accuracy
parent
04b01c4e50
commit
a1e58e3e99
|
@ -3309,15 +3309,16 @@ class Kubernetes {
|
||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
let existsAlready = false;
|
let existsAlready = false;
|
||||||
|
let status;
|
||||||
try {
|
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));
|
cloud_runner_logger_1.default.log(JSON.stringify((_a = status.body.status) === null || _a === void 0 ? void 0 : _a.containerStatuses, undefined, 4));
|
||||||
existsAlready = true;
|
existsAlready = true;
|
||||||
}
|
}
|
||||||
catch (_d) {
|
catch (_d) {
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
if (!existsAlready) {
|
if (!existsAlready || status.state.terminated !== undefined) {
|
||||||
cloud_runner_logger_1.default.log('Job does not exist');
|
cloud_runner_logger_1.default.log('Job does not exist');
|
||||||
yield this.createNamespacedJob(commands, image, mountdir, workingdir, environment, secrets);
|
yield this.createNamespacedJob(commands, image, mountdir, workingdir, environment, secrets);
|
||||||
const find = yield Kubernetes.findPodFromJob(this.kubeClient, this.jobName, this.namespace);
|
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) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
let existsAlready = false;
|
let existsAlready = false;
|
||||||
|
let status;
|
||||||
try {
|
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));
|
CloudRunnerLogger.log(JSON.stringify(status.body.status?.containerStatuses, undefined, 4));
|
||||||
existsAlready = true;
|
existsAlready = true;
|
||||||
} catch {
|
} catch {
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
if (!existsAlready) {
|
if (!existsAlready || status.state.terminated !== undefined) {
|
||||||
CloudRunnerLogger.log('Job does not exist');
|
CloudRunnerLogger.log('Job does not exist');
|
||||||
await this.createNamespacedJob(commands, image, mountdir, workingdir, environment, secrets);
|
await this.createNamespacedJob(commands, image, mountdir, workingdir, environment, secrets);
|
||||||
const find = await Kubernetes.findPodFromJob(this.kubeClient, this.jobName, this.namespace);
|
const find = await Kubernetes.findPodFromJob(this.kubeClient, this.jobName, this.namespace);
|
||||||
|
|
Loading…
Reference in New Issue