Skip to content

Commit

Permalink
refactor(core): Convey error stack from job failure to main (#11261)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivov authored Oct 15, 2024
1 parent 76ab780 commit 190665d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
19 changes: 13 additions & 6 deletions packages/cli/src/scaling/scaling.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export class ScalingService {
executionId,
workerId: this.instanceSettings.hostId,
errorMsg: error.message,
errorStack: error.stack ?? '',
};

await job.progress(msg);
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/scaling/scaling.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down

0 comments on commit 190665d

Please sign in to comment.