Improve k8s logging accuracy
parent
aa18edc853
commit
6c533e123b
|
@ -3308,11 +3308,17 @@ class Kubernetes {
|
|||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
try {
|
||||
const existsAlready = yield this.doesJobExist(this.jobName);
|
||||
const existsFailedAlready = yield this.doesFailedJobExist();
|
||||
cloud_runner_logger_1.default.log(JSON.stringify(yield this.kubeClient.readNamespacedPodStatus(this.podName, this.namespace), undefined, 4));
|
||||
cloud_runner_logger_1.default.log(JSON.stringify(yield this.kubeClient.readNamespacedPod(this.podName, this.namespace), undefined, 4));
|
||||
if (!existsAlready || existsFailedAlready) {
|
||||
let existsAlready = false;
|
||||
try {
|
||||
const status = yield this.kubeClient.readNamespacedPodStatus(this.podName, this.namespace);
|
||||
cloud_runner_logger_1.default.log(JSON.stringify(status, undefined, 4));
|
||||
cloud_runner_logger_1.default.log(JSON.stringify(yield this.kubeClient.readNamespacedPod(this.podName, this.namespace), undefined, 4));
|
||||
existsAlready = true;
|
||||
}
|
||||
catch (_c) {
|
||||
// empty
|
||||
}
|
||||
if (!existsAlready) {
|
||||
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);
|
||||
|
@ -3337,7 +3343,7 @@ class Kubernetes {
|
|||
try {
|
||||
errorParsed = JSON.parse(error);
|
||||
}
|
||||
catch (_c) {
|
||||
catch (_d) {
|
||||
errorParsed = error;
|
||||
}
|
||||
const errorMessage = errorParsed.name || errorParsed.reason || ((_b = (_a = errorParsed.response) === null || _a === void 0 ? void 0 : _a.body) === null || _b === void 0 ? void 0 : _b.reason) || errorParsed.message;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -133,15 +133,18 @@ class Kubernetes implements ProviderInterface {
|
|||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
try {
|
||||
const existsAlready = await this.doesJobExist(this.jobName);
|
||||
const existsFailedAlready = await this.doesFailedJobExist();
|
||||
CloudRunnerLogger.log(
|
||||
JSON.stringify(await this.kubeClient.readNamespacedPodStatus(this.podName, this.namespace), undefined, 4),
|
||||
);
|
||||
CloudRunnerLogger.log(
|
||||
JSON.stringify(await this.kubeClient.readNamespacedPod(this.podName, this.namespace), undefined, 4),
|
||||
);
|
||||
if (!existsAlready || existsFailedAlready) {
|
||||
let existsAlready = false;
|
||||
try {
|
||||
const status = await this.kubeClient.readNamespacedPodStatus(this.podName, this.namespace);
|
||||
CloudRunnerLogger.log(JSON.stringify(status, undefined, 4));
|
||||
CloudRunnerLogger.log(
|
||||
JSON.stringify(await this.kubeClient.readNamespacedPod(this.podName, this.namespace), undefined, 4),
|
||||
);
|
||||
existsAlready = true;
|
||||
} catch {
|
||||
// empty
|
||||
}
|
||||
if (!existsAlready) {
|
||||
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