-
Notifications
You must be signed in to change notification settings - Fork 390
FirebaseML - adding Long Running Operation support #951
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some suggestions for improvement. Didn't look at the unit tests yet. Will get to them in the next round.
package.json
Outdated
@@ -62,7 +62,7 @@ | |||
}, | |||
"optionalDependencies": { | |||
"@google-cloud/firestore": "^4.0.0", | |||
"@google-cloud/storage": "^5.0.0" | |||
"@google-cloud/storage": "^5.1.2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it was, I just installed the latest, I guess it changed this file too. I'll revert.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks mostly good. I went through the tests as well. Had a couple of questions around toJSON
and equals
plus some other suggestions.
return this.getModel(modelId); | ||
} | ||
|
||
return this.pollOperationWithExponentialBackoff(opName, options); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
opName is first used here. May be just remove the variable and use op.name!
directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Also since there's a new API here, shouldn't there be some changes in the d.ts file? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. Just had a few nits. I'll be at an LGTM once they are addressed.
Adding @egilmorez to review the changes to d.ts file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. LGTM with a nit.
// because models with active operations came back from the server and | ||
// were constructed with a non-empty client. | ||
return this.client!.handleOperation(this.model.activeOperations![0], { wait: true, maxTimeMillis }) | ||
.then((modelResponse) => this.updateFromResponse(modelResponse)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: updateFromResponse is now a one-liner. Just this.model = Model.validateAndClone(modelResponse);
and remove the updateFromResponse()
helper.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The index.d.ts changes look good, just a couple nits. Thanks!
src/index.d.ts
Outdated
@@ -1317,12 +1317,18 @@ declare namespace admin.machineLearning { | |||
/** | |||
* Wait for the model to be unlocked. | |||
* | |||
* @param {number} maxTimeSeconds The maximum time in seconds to wait. | |||
* @param {number} maxTimeMillis The maximum time in milliseconds to wait. | |||
* If not specified, a default maximum of 2 minutes will be used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We try to avoid "will." Suggest just "is used."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/index.d.ts
Outdated
waitForUnlocked(maxTimeMillis?: number): Promise<void>; | ||
|
||
/** | ||
* Return the JSON format of the model. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels slightly weird, unless "format" is a special noun in your context.
Would "Return the model in JSON format" or "as a JSON object" work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Add long running operation support