File tree 5 files changed +4738
-6634
lines changed
5 files changed +4738
-6634
lines changed Original file line number Diff line number Diff line change @@ -125,6 +125,7 @@ class JobClient{
125
125
. then (
126
126
( response ) => {
127
127
logger . info ( `submitJob(${ job . model . identifier } , ${ job . model . version } ) :: ${ response . status } ${ response . statusText } ` ) ;
128
+ response . data . status = "SUBMITTED" ;
128
129
return response . data ;
129
130
}
130
131
)
Original file line number Diff line number Diff line change @@ -343,7 +343,7 @@ class ModelClient{
343
343
* @return {String } A json string with the output sample
344
344
* @throws {ApiError } Error if there is something wrong with the service or the call
345
345
*/
346
- getModelVersionInputSample ( modelId , versionId ) {
346
+ getModelVersionOutputSample ( modelId , versionId ) {
347
347
const requestURL = `${ this . baseURL } /${ modelId } /versions/${ versionId } /sample-output` ;
348
348
logger . debug ( `getModelVersionOutputSample(${ modelId } , ${ versionId } ) GET ${ requestURL } ` ) ;
349
349
return axios . get (
Original file line number Diff line number Diff line change @@ -283,27 +283,31 @@ class ModzyClient {
283
283
*/
284
284
blockUntilComplete ( job ) {
285
285
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
+ ) ;
307
311
}
308
312
309
313
/**
Original file line number Diff line number Diff line change @@ -115,9 +115,26 @@ test(
115
115
}
116
116
)
117
117
. 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 ;
121
138
}
122
139
)
123
140
. then (
You can’t perform that action at this time.
0 commit comments