Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added logs and error catches for possible failures in queue mode #3032

Merged
merged 1 commit into from
Mar 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions packages/cli/commands/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,14 @@ export class Worker extends Command {

async runJob(job: Bull.Job, nodeTypes: INodeTypes): Promise<IBullJobResponse> {
const jobData = job.data as IBullJobData;
const executionDb = (await Db.collections.Execution!.findOne(
jobData.executionId,
)) as IExecutionFlattedDb;
const executionDb = await Db.collections.Execution!.findOne(jobData.executionId);

if (!executionDb) {
LoggerProxy.error('Worker failed to find execution data in database. Cannot continue.', {
executionId: jobData.executionId,
});
throw new Error('Unable to find execution data in database. Aborting execution.');
}
const currentExecutionDb = ResponseHelper.unflattenExecutionData(executionDb);
LoggerProxy.info(
`Start job: ${job.id} (Workflow ID: ${currentExecutionDb.workflowData.id} | Execution: ${jobData.executionId})`,
Expand All @@ -139,6 +144,13 @@ export class Worker extends Command {
findOptions,
);
if (workflowData === undefined) {
LoggerProxy.error(
'Worker execution failed because workflow could not be found in database.',
{
workflowId: currentExecutionDb.workflowData.id,
executionId: jobData.executionId,
},
);
throw new Error(
`The workflow with the ID "${currentExecutionDb.workflowData.id}" could not be found`,
);
Expand Down