Skip to content

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

Merged
merged 6 commits into from
Jul 22, 2020
Merged

Conversation

ifielker
Copy link
Contributor

@ifielker ifielker commented Jul 15, 2020

Add long running operation support

Copy link
Contributor

@hiranya911 hiranya911 left a 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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this needed?

Copy link
Contributor Author

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.

@hiranya911 hiranya911 assigned ifielker and unassigned hiranya911 Jul 16, 2020
Copy link
Contributor

@hiranya911 hiranya911 left a 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);
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@hiranya911
Copy link
Contributor

Also since there's a new API here, shouldn't there be some changes in the d.ts file?

@hiranya911 hiranya911 removed their assignment Jul 20, 2020
Copy link
Contributor

@hiranya911 hiranya911 left a 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.

@hiranya911 hiranya911 requested a review from egilmorez July 21, 2020 00:13
@hiranya911 hiranya911 assigned egilmorez and unassigned hiranya911 Jul 21, 2020
Copy link
Contributor

@hiranya911 hiranya911 left a 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));
Copy link
Contributor

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.

Copy link
Contributor

@egilmorez egilmorez left a 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.
Copy link
Contributor

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."

Copy link
Contributor Author

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.
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@ifielker ifielker merged commit 8b7ce46 into ml-automl Jul 22, 2020
@ifielker ifielker deleted the if-automl-1 branch July 22, 2020 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants