-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(sdk): Propagate transformer ID during re-deployment (#497)
<!-- Thanks for sending a pull request! Here are some tips for you: 1. Run unit tests and ensure that they are passing 2. If your change introduces any API changes, make sure to update the e2e tests 3. Make sure documentation is updated for your PR! --> **What this PR does / why we need it**: <!-- Explain here the context and why you're making the change. What is the problem you're trying to solve. ---> This PR exposes the Transformer `id` to the SDK methods so that, in the event of a model redeployment, the transformer's ID can be re-used to trigger an update. **Which issue(s) this PR fixes**: <!-- *Automatically closes linked issue when PR is merged. Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`. --> Model redeployment capabilities were added to the SDK in #455. With this, however, transformer updates were not being done correctly and instead, a new transformer entity would be attempted to be created with every version endpoint update (re-deployment). The re-deployment operation would eventually fail with an error like below, leaving the endpoint stuck in the "pending" state: ``` unable to update endpoint status for model: abcd, version: 2, reason: ERROR: duplicate key value violates unique constraint "transformers_version_endpoint_id_key" (SQLSTATE 23505) ``` This PR addresses this issue by exposing the transformer's id to the SDK and copying the id to the new transformer specs, during version endpoint updates. #### Summary of changes * `swagger.yaml` - Update `Transformer` specs to include `id` * `api/client/`, `python/sdk/client/` - Re-generate client code * `python/sdk/merlin/endpoint.py` - Add `transformer` property to `VersionEndpoint` * `python/sdk/merlin/model.py` - Propagate transformer id during re-deployment - Re-get the endpoint after a deployment so that its status would've updated to "pending". When updating an endpoint (PUT), the status change to "pending" is not immediate and may not be reflected in the response from the update call. * `python/sdk/merlin/transformer.py` - Add `id` property to the `Transformer` class * `python/sdk/test/integration_test.py` - Expand the re-deployment test case to cover the id check for transformer. In the test case, the Tensorflow model (which requires a specific input) is replaced with a custom model so that the echo transformer can be used alongside. * `python/sdk/test/model_test.py` - Update mock responses, owning to the change in `python/sdk/merlin/model.py` to re-get the version endpoint after deployment. **Does this PR introduce a user-facing change?**: <!-- If no, just write "NONE" in the release-note block below. If yes, a release note is required. Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required". For more information about release notes, see kubernetes' guide here: http://git.k8s.io/community/contributors/guide/release-notes.md --> ```release-note Fix: Update transformer specs correctly when re-deploying a model through the SDK ``` **Checklist** - [x] Added unit test, integration, and/or e2e tests - [x] Tested locally - [ ] Updated documentation - [ ] Update Swagger spec if the PR introduce API changes - [x] Regenerated Golang and Python client if the PR introduce API changes
- Loading branch information
1 parent
3340e2f
commit 67b0583
Showing
19 changed files
with
255 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.