Skip to content

Commit

Permalink
fix: Allow GraphQL query to non-installed images (#2250)
Browse files Browse the repository at this point in the history
This pull request is a follow-up of #2136.

It has been observed that the `images(is_installed: Boolean)` GraphQL queries would fail to query `images(is_installed: false)` due to:
https://github.com/lablup/backend.ai/blob/05da1590095a61677402211cc84e74a07340b276/src/ai/backend/manager/models/gql.py#L1175-L1176

**Checklist:** (if applicable)

- [x] Milestone metadata specifying the target backport version
- [x] Mention to the original issue
- [ ] Installer updates including:
  - Fixtures for db schema changes
  - New mandatory config options
- [ ] Update of end-to-end CLI integration tests in `ai.backend.test`
- [ ] API server-client counterparts (e.g., manager API -> client SDK)
- [ ] Test case(s) to:
  - Demonstrate the difference of before/after
  - Demonstrate the flow of abstract/conceptual models with a concrete implementation
- [ ] Documentation
  - Contents in the `docs` directory
  - docstrings in public interfaces and type annotations

<!-- readthedocs-preview sorna start -->
----
📚 Documentation preview 📚: https://sorna--2250.org.readthedocs.build/en/2250/

<!-- readthedocs-preview sorna end -->

<!-- readthedocs-preview sorna-ko start -->
----
📚 Documentation preview 📚: https://sorna-ko--2250.org.readthedocs.build/ko/2250/

<!-- readthedocs-preview sorna-ko end -->
  • Loading branch information
rapsealk committed Jun 27, 2024
1 parent 4815659 commit 61e7a4d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions changes/2250.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix GraphQL to support query to non-installed images
4 changes: 2 additions & 2 deletions src/ai/backend/manager/models/gql.py
Original file line number Diff line number Diff line change
Expand Up @@ -1130,7 +1130,7 @@ async def resolve_images(
root: Any,
info: graphene.ResolveInfo,
*,
is_installed=None,
is_installed: bool | None = None,
is_operation=False,
image_filters: list[str] | None = None,
) -> Sequence[Image]:
Expand Down Expand Up @@ -1173,7 +1173,7 @@ async def resolve_images(
else:
raise InvalidAPIParameters("Unknown client role")
if is_installed is not None:
items = [item for item in items if item.installed]
items = [item for item in items if item.installed == is_installed]
return items

@staticmethod
Expand Down

0 comments on commit 61e7a4d

Please sign in to comment.