Skip to content
This repository was archived by the owner on Jun 6, 2023. It is now read-only.

Commit 4828033

Browse files
colin-welchsanfilip
authored andcommitted
tweak: Add support for the "Cancelled" job state.
1 parent 4154dbe commit 4828033

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/jobs/create.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ function create(params, cb) {
233233
if (!res.state) return new Error('Job state not found.');
234234
var state = res.state;
235235
console.log('Job ' + state);
236-
if (state !== 'Stopped' && state !== 'Failed' && state !== 'Running') {
236+
if (state !== 'Stopped' && state !== 'Failed' && state !== 'Cancelled' && state !== 'Running') {
237237
if (state === 'Error' || res.jobError) console.log('Error: ' + res.jobError);
238238
return cb();
239239
}

lib/jobs/waitfor.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ var assign = require('lodash.assign');
1515
* - Stopped - the job finished with a job command exit code of 0
1616
* - Error - the job was unable to setup or run to normal completion
1717
* - Failed - the job finished but the job command exit code was non-zero
18+
* - Cancelled - the job was manual stopped before completion
1819
*
1920
* When the callback is called, the returned object will be information about the job.
2021
* @param {object} params - Job waitfor parameters
@@ -101,7 +102,8 @@ function waitfor(params, cb) {
101102
(job.state === 'Running' && params.state === 'Pending') ||
102103
job.state === 'Error' ||
103104
job.state === 'Stopped' ||
104-
job.state === 'Failed') {
105+
job.state === 'Failed' ||
106+
job.state === 'Cancelled') {
105107
return cb(null, job);
106108
}
107109
var interval = setTimeout(function _interval() {

0 commit comments

Comments
 (0)