Skip to content

Commit

Permalink
Update attributes on cancel job. Fixes #617
Browse files Browse the repository at this point in the history
  • Loading branch information
brollb committed Aug 3, 2016
1 parent 96f2090 commit 12b8864
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/visualizers/panels/ForgeActionButton/Actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,16 @@ define([
action: function() {
// Stop every running job
var execNode = this.client.getNode(this._currentNodeId),
jobIds = execNode.getChildrenIds();
jobIds = execNode.getChildrenIds(),
msg = `Canceling ${execNode.getAttribute('name')} execution`;

this.client.startTransaction(msg);
jobIds.map(id => this.client.getNode(id))
.filter(job => this.isJobRunning(job)) // get running jobs
.forEach(job => this.stopJob(job)); // stop them

this.client.setAttributes(execNode, 'status', 'canceled');
this.client.completeTransaction();
}
}
],
Expand Down
14 changes: 12 additions & 2 deletions src/visualizers/panels/ForgeActionButton/ForgeActionButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,18 @@ define([
}

return this._executor.cancelJob(jobHash, secret)
.then(() => this.logger.info(`${jobHash} has been cancelled!`))
.fail(err => this.logger.error(`Job cancel failed: ${err}`));
.then(() => {
this.logger.info(`${jobHash} has been cancelled!`);
this.client.delAttributes(job, 'jobId');
this.client.delAttributes(job, 'secret');
this.client.setAttributes(job, 'status', 'canceled');
})
.fail(err => {
this.logger.error(`Job cancel failed: ${err}`);
this.client.delAttributes(job, 'jobId');
this.client.delAttributes(job, 'secret');
this.client.setAttributes(job, 'status', 'canceled');
});
};

return ForgeActionButton;
Expand Down

0 comments on commit 12b8864

Please sign in to comment.