Skip to content

Commit

Permalink
fix: add missing type argument in group query (#2073)
Browse files Browse the repository at this point in the history
<!--
Please precisely, concisely, and concretely describe what this PR changes, the rationale behind codes,
and how it affects the users and other developers.
-->

**Checklist:** (if applicable)

- [x] Milestone metadata specifying the target backport version

Tested manually.

## Before

![2024-04-26_12-09-22](https://github.com/lablup/backend.ai/assets/18283033/b3680cbd-6be4-44ea-8135-db60cc28b3d2)

## After

![2024-04-26_12-39-12](https://github.com/lablup/backend.ai/assets/18283033/692aec5e-bb12-4a72-9f4b-202ee5e657ae)

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

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

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

<!-- readthedocs-preview sorna-ko end -->
  • Loading branch information
jopemachine committed Apr 29, 2024
1 parent eb6bcad commit cf13dcc
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 18 deletions.
1 change: 1 addition & 0 deletions changes/2073.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add missing type argument in group query
20 changes: 13 additions & 7 deletions src/ai/backend/manager/api/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,19 @@ type Queries {

"""Added in 24.03.0."""
group_nodes(filter: String, order: String, offset: Int, before: String, after: String, first: Int, last: Int): GroupConnection
group(id: UUID!, domain_name: String): Group
group(
id: UUID!
domain_name: String

"""Added in 24.03.0."""
type: [String] = ["GENERAL"]

Check warning on line 30 in src/ai/backend/manager/api/schema.graphql

View workflow job for this annotation

GitHub Actions / GraphQL Inspector

Argument 'type: [String]' (with default value) added to field 'Queries.group'

Adding a new argument to an existing field may involve a change in resolve function logic that potentially may cause some side effects.
): Group
groups_by_name(name: String!, domain_name: String): [Group]
groups(
domain_name: String
is_active: Boolean

"""Added since 24.03.0. Available values: GENERAL, MODEL_STORE"""
"""Added in 24.03.0."""
type: [String] = ["GENERAL"]

Check notice on line 38 in src/ai/backend/manager/api/schema.graphql

View workflow job for this annotation

GitHub Actions / GraphQL Inspector

Description for argument 'type' on field 'Queries.groups' changed from 'Added since 24.03.0. Available values: GENERAL, MODEL_STORE' to 'Added in 24.03.0.'

Description for argument 'type' on field 'Queries.groups' changed from 'Added since 24.03.0. Available values: GENERAL, MODEL_STORE' to 'Added in 24.03.0.'
): [Group]
image(
Expand All @@ -39,7 +45,7 @@ type Queries {
): Image
images(is_installed: Boolean, is_operation: Boolean): [Image]

"""Added since 24.03.1"""
"""Added in 24.03.1"""
customized_images: [ImageNode]

Check notice on line 49 in src/ai/backend/manager/api/schema.graphql

View workflow job for this annotation

GitHub Actions / GraphQL Inspector

Field 'Queries.customized_images' description changed from 'Added since 24.03.1' to 'Added in 24.03.1'

Field 'Queries.customized_images' description changed from 'Added since 24.03.1' to 'Added in 24.03.1'
user(domain_name: String, email: String): User
user_from_uuid(domain_name: String, user_id: ID): User
Expand Down Expand Up @@ -1002,7 +1008,7 @@ type Mutations {
unload_image(references: [String]!, target_agents: [String]!): UnloadImage
modify_image(architecture: String = "x86_64", props: ModifyImageInput!, target: String!): ModifyImage

"""Added since 24.03.0"""
"""Added in 24.03.0"""
forget_image_by_id(image_id: String!): ForgetImageById

Check notice on line 1012 in src/ai/backend/manager/api/schema.graphql

View workflow job for this annotation

GitHub Actions / GraphQL Inspector

Field 'Mutations.forget_image_by_id' description changed from 'Added since 24.03.0' to 'Added in 24.03.0'

Field 'Mutations.forget_image_by_id' description changed from 'Added since 24.03.0' to 'Added in 24.03.0'
forget_image(architecture: String = "x86_64", reference: String!): ForgetImage

Expand Down Expand Up @@ -1107,7 +1113,7 @@ type CreateGroup {
}

input GroupInput {
"""Added since 24.03.0. Available values: GENERAL, MODEL_STORE"""
"""Added in 24.03.0."""
type: String = "GENERAL"

Check notice on line 1117 in src/ai/backend/manager/api/schema.graphql

View workflow job for this annotation

GitHub Actions / GraphQL Inspector

Input field 'GroupInput.type' description changed from 'Added since 24.03.0. Available values: GENERAL, MODEL_STORE' to 'Added in 24.03.0.'

Input field 'GroupInput.type' description changed from 'Added since 24.03.0. Available values: GENERAL, MODEL_STORE' to 'Added in 24.03.0.'
description: String = ""
is_active: Boolean = true
Expand All @@ -1117,7 +1123,7 @@ input GroupInput {
integration_id: String = ""
resource_policy: String = "default"

"""Added since 24.03.0"""
"""Added in 24.03.0"""
container_registry: JSONString = "{}"

Check notice on line 1127 in src/ai/backend/manager/api/schema.graphql

View workflow job for this annotation

GitHub Actions / GraphQL Inspector

Input field 'GroupInput.container_registry' description changed from 'Added since 24.03.0' to 'Added in 24.03.0'

Input field 'GroupInput.container_registry' description changed from 'Added since 24.03.0' to 'Added in 24.03.0'
}

Expand All @@ -1139,7 +1145,7 @@ input ModifyGroupInput {
integration_id: String
resource_policy: String

"""Added since 24.03.0"""
"""Added in 24.03.0"""
container_registry: JSONString = "{}"

Check notice on line 1149 in src/ai/backend/manager/api/schema.graphql

View workflow job for this annotation

GitHub Actions / GraphQL Inspector

Input field 'ModifyGroupInput.container_registry' description changed from 'Added since 24.03.0' to 'Added in 24.03.0'

Input field 'ModifyGroupInput.container_registry' description changed from 'Added since 24.03.0' to 'Added in 24.03.0'
}

Expand Down
15 changes: 9 additions & 6 deletions src/ai/backend/manager/models/gql.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ class Mutations(graphene.ObjectType):
preload_image = PreloadImage.Field()
unload_image = UnloadImage.Field()
modify_image = ModifyImage.Field()
forget_image_by_id = ForgetImageById.Field(description="Added since 24.03.0")
forget_image_by_id = ForgetImageById.Field(description="Added in 24.03.0")
forget_image = ForgetImage.Field()
untag_image_from_registry = UntagImageFromRegistry.Field(description="Added in 24.03.1")
alias_image = AliasImage.Field()
Expand Down Expand Up @@ -323,6 +323,11 @@ class Queries(graphene.ObjectType):
Group,
id=graphene.UUID(required=True),
domain_name=graphene.String(),
type=graphene.List(
graphene.String,
default_value=[ProjectType.GENERAL.name],
description=("Added in 24.03.0."),
),
)

# Within a single domain, this will always return nothing or a single item,
Expand All @@ -341,9 +346,7 @@ class Queries(graphene.ObjectType):
type=graphene.List(
graphene.String,
default_value=[ProjectType.GENERAL.name],
description=(
f"Added since 24.03.0. Available values: {', '.join([p.name for p in ProjectType])}"
),
description=("Added in 24.03.0."),
),
)

Expand All @@ -360,7 +363,7 @@ class Queries(graphene.ObjectType):
is_operation=graphene.Boolean(),
)

customized_images = graphene.List(ImageNode, description="Added since 24.03.1")
customized_images = graphene.List(ImageNode, description="Added in 24.03.1")

user = graphene.Field(
User,
Expand Down Expand Up @@ -877,7 +880,7 @@ async def resolve_group(
info: graphene.ResolveInfo,
id: uuid.UUID,
*,
domain_name: str = None,
domain_name: str | None = None,
type: list[str] = [ProjectType.GENERAL.name],
) -> Group:
ctx: GraphQueryContext = info.context
Expand Down
8 changes: 3 additions & 5 deletions src/ai/backend/manager/models/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,9 +426,7 @@ class GroupInput(graphene.InputObjectType):
type = graphene.String(
required=False,
default_value="GENERAL",
description=(
f"Added since 24.03.0. Available values: {', '.join([p.name for p in ProjectType])}"
),
description=("Added in 24.03.0."),
)
description = graphene.String(required=False, default_value="")
is_active = graphene.Boolean(required=False, default_value=True)
Expand All @@ -438,7 +436,7 @@ class GroupInput(graphene.InputObjectType):
integration_id = graphene.String(required=False, default_value="")
resource_policy = graphene.String(required=False, default_value="default")
container_registry = graphene.JSONString(
required=False, default_value={}, description="Added since 24.03.0"
required=False, default_value={}, description="Added in 24.03.0"
)


Expand All @@ -454,7 +452,7 @@ class ModifyGroupInput(graphene.InputObjectType):
integration_id = graphene.String(required=False)
resource_policy = graphene.String(required=False)
container_registry = graphene.JSONString(
required=False, default_value={}, description="Added since 24.03.0"
required=False, default_value={}, description="Added in 24.03.0"
)


Expand Down

0 comments on commit cf13dcc

Please sign in to comment.