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

Purge compute job after recording results. Closes #1978 #1979

Merged
merged 2 commits into from
Nov 11, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Purge compute job after recording results. Closes #1978
  • Loading branch information
brollb committed Nov 11, 2020
commit df6f32b27d63cbe2b843e49608816d22b02963c6
2 changes: 1 addition & 1 deletion src/common/compute/backends/local/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ define([
return JSON.parse(resultsTxt);
}

async purge (job) {
async purgeJob (job) {
const {hash} = job;
if (hash === this.currentJob) {
throw new Error('Cannot purge running job.');
Expand Down
12 changes: 9 additions & 3 deletions src/plugins/ExecuteJob/ExecuteJob.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ define([
ExecuteJobMetadata.call(this);
this.pluginMetadata = pluginMetadata;
this._running = null;
this._computeJobs = {};

// Metadata updating
this.lastAppliedCmd = {};
Expand Down Expand Up @@ -190,20 +191,24 @@ define([

compute.on('end',
async (id/*, info*/) => {
const computeJob = this._computeJobs[id];
try {
const job = this.getNodeForJobId(id);
if (job === null) {
assert(
this.canceled,
`Cannot find node for job ID in running pipeline: ${id}`
);
await compute.purgeJob(computeJob);
return;
}
this.cleanJobHashInfo(id);
await this.onOperationEnd(null, job);
await compute.purgeJob(computeJob);
} catch (err) {
this.logger.error(`Error when processing operation end: ${err}`);
await this.save('Saving remaining edits before pipeline exits w/ error.');
await compute.purgeJob(computeJob);
throw err;
}
}
Expand Down Expand Up @@ -534,6 +539,7 @@ define([
this.startExecHeartBeat();
}

this._computeJobs[jobInfo.hash] = computeJob;
return await this.recordJobOrigin(jobInfo.hash, job);
};

Expand Down Expand Up @@ -673,14 +679,14 @@ define([
this.logManager.deleteLog(jobId);
if (status === this.compute.SUCCESS) {
const results = await this.compute.getResultsInfo(jobInfo);
await this.recordOperationOutputs(op, results);
return this.recordOperationOutputs(op, results);
} else {
// Parse the most precise error and present it in the toast...
const lastline = result.stdout.split('\n').filter(l => !!l).pop() || '';
if (lastline.includes('Error')) {
this.onOperationFail(op, lastline);
return this.onOperationFail(op, lastline);
} else {
this.onOperationFail(op, `Operation "${opName}" failed!`);
return this.onOperationFail(op, `Operation "${opName}" failed!`);
}
}
} else { // something bad happened...
Expand Down