Resolve issue with AttributeError during update of Serving Endpoint tags#713
Resolve issue with AttributeError during update of Serving Endpoint tags#713pivoshenko wants to merge 28 commits intodatabricks:mainfrom
Conversation
…int tags Signed-off-by: Volodymyr Pivoshenko <volodymyr.pivoshenko@gmail.com>
Signed-off-by: Volodymyr Pivoshenko <40499728+pivoshenko@users.noreply.github.com>
|
Please ensure that the NEXT_CHANGELOG.md file is updated with any relevant changes. |
|
If integration tests don't run automatically, an authorized user can run them manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
There was a problem hiding this comment.
Pull request overview
Fixes the serving endpoint tags patch response handling that currently raises an AttributeError, and adds GitHub label management automation for the repository.
Changes:
- Adjust serving endpoint tag
patch()response parsing inserving.py. - Add a GitHub Actions workflow to sync repository labels from a YAML definition.
- Add a
.github/labels.yamllabel definition file.
Reviewed changes
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
databricks/sdk/service/serving.py |
Changes how the tags PATCH response is deserialized/returned. |
.github/workflows/labels.yaml |
Adds a workflow to update GitHub labels on pushes to main. |
.github/labels.yaml |
Defines the repository label set to be applied by the workflow. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| res = self._api.do('PATCH', f'/api/2.0/serving-endpoints/{name}/tags', body=body, headers=headers) | ||
| return EndpointTags.from_dict(res) | ||
| return [EndpointTag.from_dict(v) for v in res["tags"]] |
There was a problem hiding this comment.
patch() is annotated/documented to return EndpointTags, but the implementation now returns a bare List[EndpointTag]. This is a breaking API change for callers expecting an EndpointTags object (e.g., accessing .tags) and also makes the method behavior inconsistent with its docstring/type hints. Consider keeping the EndpointTags return type and adapting the response parsing inside that wrapper (also preserving the previous behavior of returning an empty list when the response has no tags field instead of raising KeyError).
| return [EndpointTag.from_dict(v) for v in res["tags"]] | |
| return EndpointTags(tags=[EndpointTag.from_dict(v) for v in res.get("tags", [])]) |
|
|
||
| res = self._api.do('PATCH', f'/api/2.0/serving-endpoints/{name}/tags', body=body, headers=headers) | ||
| return EndpointTags.from_dict(res) | ||
| return [EndpointTag.from_dict(v) for v in res["tags"]] |
There was a problem hiding this comment.
EndpointTags.from_dict(res) already deserializes res['tags'] by calling EndpointTag.from_dict for each element (via _repeated_dict). Replacing it with a manual list comprehension doesn’t materially change how individual tags are unpacked when res['tags'] is a list, but it does drop the EndpointTags wrapper and loses the helper’s safer handling for missing/empty fields. If the goal is to fix an AttributeError, it’s worth adjusting the model/deserializer to match the real response shape rather than duplicating the same loop here.
| return [EndpointTag.from_dict(v) for v in res["tags"]] | |
| return EndpointTags.from_dict(res) |
Hi, thanks for the SDK it's really useful! I noticed today that when you try to update tags in the serving endpoint using the
patchmethod it fails withAttributeError. The fix is very straightforward. 🐱Changes
I just updated the way how responses are unpacked and passed into
EndpointTagTests
I tested it using my personal dev account.
make testrun locallymake fmtappliedThanks!