Skip to content

Commit

Permalink
add more guards on metadata update
Browse files Browse the repository at this point in the history
  • Loading branch information
Dando18 committed Dec 4, 2024
1 parent fe2ab51 commit f352d26
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/scheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,13 +423,15 @@ export class SlurmScheduler implements Scheduler {
return job.outputFile; /* early exit if it's already defined */
}

this.patchJobWithRuntimeMetadata(job);
if (job.outputFile) {
return job.outputFile;
} else {
try {
this.patchJobWithRuntimeMetadata(job);
if (!job.outputFile) {
throw new Error('Failed to get job output path.');
}
} catch (error) {
vscode.window.showErrorMessage(`Failed to get job output path for job ${job.id}.`);
return undefined;
}
return job.outputFile;
}

/**
Expand All @@ -450,13 +452,15 @@ export class SlurmScheduler implements Scheduler {
return job.errorFile; /* early exit if it's already defined */
}

this.patchJobWithRuntimeMetadata(job);
if (job.errorFile) {
return job.errorFile;
} else {
try {
this.patchJobWithRuntimeMetadata(job);
if (!job.errorFile) {
throw new Error('Failed to get job error path.');
}
} catch (error) {
vscode.window.showErrorMessage(`Failed to get job error path for job ${job.id}.`);
return undefined;
}
return job.errorFile;
}
}

Expand Down

0 comments on commit f352d26

Please sign in to comment.