Skip to content

Commit

Permalink
Added "complete" notification if exec forked. Fixes #596 (#598)
Browse files Browse the repository at this point in the history
WIP #596 Added quotes around job, exec, branch for consistency
  • Loading branch information
brollb authored Aug 3, 2016
1 parent 475bdfe commit 2d9d1e7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/plugins/ExecuteJob/ExecuteJob.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ define([
}

this._callback = callback;
this.currentForkName = null;
this.prepare()
.then(() => this.executeJob(this.activeNode));
};
Expand Down Expand Up @@ -111,6 +112,7 @@ define([
var msg;
if (result.status === STORAGE_CONSTANTS.FORKED) {
msg = `"${name}" execution has forked to "${result.forkName}"`;
this.currentForkName = result.forkName;
this.sendNotification(msg);
}
});
Expand Down Expand Up @@ -228,6 +230,10 @@ define([
this.logger.info(`Setting ${name} (${jobId}) status to ${status}`);
this.clearOldMetadata(job);

if (this.currentForkName) {
// notify client that the job has completed
this.sendNotification(`"${name}" execution completed on branch "${this.currentForkName}"`);
}
if (err) {
this.core.setAttribute(exec, 'status', 'failed');
} else {
Expand Down
7 changes: 7 additions & 0 deletions src/plugins/ExecutePipeline/ExecutePipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ define([
}

this._callback = callback;
this.currentForkName = null;

startPromise
.then(() => this.core.loadSubTree(this.activeNode))
Expand Down Expand Up @@ -139,6 +140,7 @@ define([
.then(result => {
var msg;
if (result.status === STORAGE_CONSTANTS.FORKED) {
this.currentForkName = result.forkName;
msg = `"${this.pipelineName}" execution has forked to "${result.forkName}"`;
this.sendNotification(msg);
}
Expand Down Expand Up @@ -286,6 +288,11 @@ define([
return;
}

if (this.currentForkName) {
// notify client that the job has completed
this.sendNotification(`"${this.pipelineName}" execution completed on branch "${this.currentForkName}"`);
}

this.logger.debug(`Pipeline "${name}" complete!`);
this.core.setAttribute(this.activeNode, 'status',
(!this.pipelineError ? 'success' : 'failed'));
Expand Down

0 comments on commit 2d9d1e7

Please sign in to comment.