File tree Expand file tree Collapse file tree 5 files changed +4738
-6634
lines changed Expand file tree Collapse file tree 5 files changed +4738
-6634
lines changed Original file line number Diff line number Diff line change @@ -125,6 +125,7 @@ class JobClient{
125125 . then (
126126 ( response ) => {
127127 logger . info ( `submitJob(${ job . model . identifier } , ${ job . model . version } ) :: ${ response . status } ${ response . statusText } ` ) ;
128+ response . data . status = "SUBMITTED" ;
128129 return response . data ;
129130 }
130131 )
Original file line number Diff line number Diff line change @@ -343,7 +343,7 @@ class ModelClient{
343343 * @return {String } A json string with the output sample
344344 * @throws {ApiError } Error if there is something wrong with the service or the call
345345 */
346- getModelVersionInputSample ( modelId , versionId ) {
346+ getModelVersionOutputSample ( modelId , versionId ) {
347347 const requestURL = `${ this . baseURL } /${ modelId } /versions/${ versionId } /sample-output` ;
348348 logger . debug ( `getModelVersionOutputSample(${ modelId } , ${ versionId } ) GET ${ requestURL } ` ) ;
349349 return axios . get (
Original file line number Diff line number Diff line change @@ -283,27 +283,31 @@ class ModzyClient {
283283 */
284284 blockUntilComplete ( job ) {
285285 logger . debug ( `blockUntilComplete(${ job . jobIdentifier } }) :: ${ job . status } ` ) ;
286- return this . jobClient . getJob ( job . jobIdentifier )
287- . then (
288- ( updatedJob ) => {
289- if ( updatedJob . status === "SUBMITTED" || updatedJob . status === "IN_PROGRESS" ) {
290- return new Promise (
291- ( resolve , reject ) => {
292- setTimeout (
293- ( ) => {
294- resolve (
295- this . blockUntilComplete ( updatedJob )
296- ) ;
297- } ,
298- 20000
299- ) ;
300- }
301- ) ;
302- }
303- logger . debug ( `blockUntilComplete(${ updatedJob . jobIdentifier } }) :: returning :: ${ updatedJob . status } ` ) ;
304- return updatedJob ;
305- }
306- )
286+ return new Promise (
287+ ( resolve , reject ) => {
288+ setTimeout (
289+ ( ) => {
290+ this . jobClient . getJob ( job . jobIdentifier )
291+ . then (
292+ ( updatedJob ) => {
293+ if ( updatedJob . status === "SUBMITTED" || updatedJob . status === "IN_PROGRESS" ) {
294+ resolve ( this . blockUntilComplete ( updatedJob ) ) ;
295+ }
296+ logger . debug ( `blockUntilComplete(${ updatedJob . jobIdentifier } }) :: returning :: ${ updatedJob . status } ` ) ;
297+ resolve ( updatedJob ) ;
298+ }
299+ )
300+ . catch (
301+ ( error ) => {
302+ logger . error ( error ) ;
303+ reject ( error ) ;
304+ }
305+ ) ;
306+ } ,
307+ 2000
308+ ) ;
309+ }
310+ ) ;
307311 }
308312
309313 /**
Original file line number Diff line number Diff line change @@ -115,9 +115,26 @@ test(
115115 }
116116 )
117117 . then (
118- ( jobIdentifier ) => {
119- logger . debug ( `testCancelJob :: canceling job :: ${ jobIdentifier } ` ) ;
120- return jobClient . cancelJob ( jobIdentifier ) ;
118+ ( jobIdentifier ) => {
119+ return new Promise (
120+ ( resolve , reject ) => {
121+ setTimeout (
122+ ( ) => {
123+ resolve ( jobClient . getJob ( jobIdentifier ) ) ;
124+ } ,
125+ 5000
126+ ) ;
127+ }
128+ ) ;
129+ }
130+ )
131+ . then (
132+ ( job ) => {
133+ if ( job . status != "COMPLETED" ) {
134+ logger . debug ( `testCancelJob :: canceling job :: ${ job . jobIdentifier } ` ) ;
135+ return jobClient . cancelJob ( job . jobIdentifier ) ;
136+ }
137+ return job ;
121138 }
122139 )
123140 . then (
You can’t perform that action at this time.
0 commit comments