refactor(core): Convey error stack from job failure to main (#11261)

This commit is contained in:
Iván Ovejero 2024-10-15 16:55:54 +02:00 committed by GitHub
parent 76ab780cdd
commit 190665d8e6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 6 deletions

View file

@ -114,6 +114,7 @@ export class ScalingService {
executionId,
workerId: this.instanceSettings.hostId,
errorMsg: error.message,
errorStack: error.stack ?? '',
};
await job.progress(msg);
@ -295,12 +296,18 @@ export class ScalingService {
});
break;
case 'job-failed':
this.logger.error(`Execution ${msg.executionId} (job ${jobId}) failed`, {
workerId: msg.workerId,
errorMsg: msg.errorMsg,
executionId: msg.executionId,
jobId,
});
this.logger.error(
[
`Execution ${msg.executionId} (job ${jobId}) failed`,
msg.errorStack ? `\n${msg.errorStack}\n` : '',
].join(''),
{
workerId: msg.workerId,
errorMsg: msg.errorMsg,
executionId: msg.executionId,
jobId,
},
);
break;
case 'abort-job':
break; // only for worker

View file

@ -56,6 +56,7 @@ export type JobFailedMessage = {
executionId: string;
workerId: string;
errorMsg: string;
errorStack: string;
};
/** Message sent by main to worker to abort a job. */