Skip to content

Commit

Permalink
feat: Individual error_msg for cards to prevent total list fetch di…
Browse files Browse the repository at this point in the history
…sruption (#2583)

related PR: lablup/backend.ai#2570

This pull request includes the following changes:

1. **Error message handling:**
   - Added error message (`error_msg`) field to `ModelCard`, and `ModelStoreListPage` components. This error messages are displayed only to superadmin and owners.
   - Updated `ModelCardModal`, `ModelStoreListPage`, and other related components to properly display error messages when they are present.
   - Added `Alert` and `Empty` components to provide better user feedback in case of errors.
2. **Architecture default value update:**
   - Changed the default value for the `architecture` field in various GraphQL types (`Queries`, `Mutations`) from "aarch64" to "x86_64".

### How to test?
1. core part: checkout lablup/backend.ai#2570
2. add a model store type (project type, model usage mode, model-store project needed)
3. add a `model-definition.yml` file referring gitbook. (if you don't know the gitbook address, please ask @agatha197)
4. the way to add a file to the model store type folder is not supported yet. so you should use scp, ssh, or others. For me, I modified the https://github.com/lablup/backend.ai-webui/blob/main/src/components/backend-ai-data-view.ts#L320 line (model -> model-store) for testing. (FOR JUST TESTING)
5. If you add an empty model-definition.yml or invalid file, you can see the error and you can still see the valid model cards.
6. you can check the details by clicking each model card. If the model card is invalid, the error message and `Empty` component will appear.

### Why make this change?
These changes enhance the user experience by providing clear and informative error messages per model card and preventing total list fetch disruption. (Before this PR, if there are invalid `model-definition.yml` files in the model store type folder, it isn't possible to fetch all lists of model cards.)

### Screenshots

![image.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/2HueYSdFvL8pOB5mgrUQ/c4538248-f8f7-40df-82a2-64dca72b63c5.png)

![image.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/2HueYSdFvL8pOB5mgrUQ/58e2d6ec-ee6d-4f18-bcb2-778125c7d312.png)

**Checklist:** (if applicable)

- [x] Mention to the original issue: [Teams Threads](https://teams.microsoft.com/l/message/19:[email protected]/1721893074477?tenantId=13c6a44d-9b52-4b9e-aa34-0513ee7131f2&groupId=b1f3bcf4-facf-40d3-94ab-169abb4f0f52&parentMessageId=1720414523279&teamName=customers%20%26%20clients&channelName=KISTI&createdTime=1721893074477)
- [ ] Documentation
- [x] Minium required manager version: 24.03.7
- [x] Specific setting for review (eg., KB link, endpoint or how to setup)
- [x] Minimum requirements to check during review
- [ ] Test case(s) to demonstrate the difference of before/after
  • Loading branch information
agatha197 committed Aug 6, 2024
1 parent 163dbb3 commit 39d7a1f
Show file tree
Hide file tree
Showing 3 changed files with 344 additions and 238 deletions.
60 changes: 51 additions & 9 deletions react/data/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,24 @@ type Queries {
"""Added in 24.03.1"""
id: String
reference: String
architecture: String = "aarch64"
architecture: String = "x86_64"
): Image
images(
"""
Added in 19.09.0. If it is specified, fetch images installed on at least one agent.
"""
is_installed: Boolean
is_operation: Boolean @deprecated(reason: "Deprecated since 24.03.4. This field is ignored if `image_filters` is specified and is not null.")
is_operation: Boolean @deprecated(reason: "Deprecated since 24.03.4. This field is ignored if `load_filters` is specified and is not null.")

"""
Added in 24.03.4. Allowed values are: [operational, customized]. When superuser queries with `customized` option set the resolver will return every customized images (including those not owned by callee). To resolve images owned by user only call `customized_images`.
Added in 24.03.8. Allowed values are: [general, operational, customized]. When superuser queries with `customized` option set the resolver will return every customized images (including those not owned by callee). To resolve images owned by user only call `customized_images`.
"""
image_filters: [String] = null
load_filters: [String] = null

"""
Added in 24.03.4. Allowed values are: [general, operational, customized]. When superuser queries with `customized` option set the resolver will return every customized images (including those not owned by caller). To list the owned images only call `customized_images`.
"""
image_filters: [String] = null @deprecated(reason: "Deprecated since 24.03.8. Use `load_filters` instead.")
): [Image]

"""Added in 24.03.1"""
Expand Down Expand Up @@ -311,6 +316,9 @@ type Domain {
type GroupNode implements Node {
"""The ID of the object"""
id: ID!

"""Added in 24.03.7. The undecoded id value stored in DB."""
row_id: UUID
name: String
description: String
is_active: Boolean
Expand All @@ -321,6 +329,12 @@ type GroupNode implements Node {
allowed_vfolder_hosts: JSONString
integration_id: String
resource_policy: String

"""Added in 24.03.7. One of ['GENERAL', 'MODEL_STORE']."""
type: String

"""Added in 24.03.7."""
container_registry: JSONString
scaling_groups: [String]
user_nodes(filter: String, order: String, offset: Int, before: String, after: String, first: Int, last: Int): UserConnection
}
Expand Down Expand Up @@ -507,6 +521,9 @@ type KeyPair implements Item {
last_used: DateTime
rate_limit: Int
num_queries: Int

"""Added in 24.09.0."""
rolling_count: Int
user: UUID
projects: [String]
ssh_public_key: String
Expand All @@ -527,6 +544,9 @@ type VirtualFolder implements Item {
group: UUID
group_name: String
creator: String

"""Added in 24.09.0."""
domain_name: String
unmanaged_path: String
usage_mode: String
permission: String
Expand Down Expand Up @@ -693,6 +713,22 @@ type ScalingGroup {
scheduler: String
scheduler_opts: JSONString
use_host_network: Boolean

"""Added in 24.03.7."""
agent_count_by_status(
"""
Possible states of an agent. Should be one of ['ALIVE', 'LOST', 'RESTARTING', 'TERMINATED']. Default is 'ALIVE'.
"""
status: String = "ALIVE"
): Int

"""Added in 24.03.7."""
agent_total_resource_slots_by_status(
"""
Possible states of an agent. Should be one of ['ALIVE', 'LOST', 'RESTARTING', 'TERMINATED']. Default is 'ALIVE'.
"""
status: String = "ALIVE"
): JSONString
}

type StorageVolume implements Item {
Expand Down Expand Up @@ -722,7 +758,7 @@ type VirtualFolderNode implements Node {
"""The ID of the object"""
id: ID!

"""Added in 24.03.4. UUID type id of DB vfolders row"""
"""Added in 24.03.4. ID of VFolder."""
row_id: UUID
host: String
quota_scope_id: String
Expand Down Expand Up @@ -1004,6 +1040,9 @@ type ModelCard implements Node {
"""The ID of the object"""
id: ID!
name: String

"""Added in 24.03.8. ID of VFolder."""
row_id: UUID
vfolder: VirtualFolder

"""Added in 24.09.0."""
Expand Down Expand Up @@ -1033,6 +1072,9 @@ type ModelCard implements Node {
Type (mostly extension of the filename) of the README file. e.g. md, rst, txt, ...
"""
readme_filetype: String

"""Added in 24.03.8."""
error_msg: String
}

type ModelCardConnection {
Expand Down Expand Up @@ -1116,15 +1158,15 @@ type Mutations {
rescan_images(registry: String): RescanImages
preload_image(references: [String]!, target_agents: [String]!): PreloadImage
unload_image(references: [String]!, target_agents: [String]!): UnloadImage
modify_image(architecture: String = "aarch64", props: ModifyImageInput!, target: String!): ModifyImage
modify_image(architecture: String = "x86_64", props: ModifyImageInput!, target: String!): ModifyImage

"""Added in 24.03.0"""
forget_image_by_id(image_id: String!): ForgetImageById
forget_image(architecture: String = "aarch64", reference: String!): ForgetImage
forget_image(architecture: String = "x86_64", reference: String!): ForgetImage

"""Added in 24.03.1"""
untag_image_from_registry(image_id: String!): UntagImageFromRegistry
alias_image(alias: String!, architecture: String = "aarch64", target: String!): AliasImage
alias_image(alias: String!, architecture: String = "x86_64", target: String!): AliasImage
dealias_image(alias: String!): DealiasImage
clear_images(registry: String): ClearImages
create_keypair_resource_policy(name: String!, props: CreateKeyPairResourcePolicyInput!): CreateKeyPairResourcePolicy
Expand Down Expand Up @@ -1844,4 +1886,4 @@ input ExtraMountInput {
Added in 24.03.4. Set permission of this mount. Should be one of (ro,rw,wd). Default is null
"""
permission: String
}
}
Loading

0 comments on commit 39d7a1f

Please sign in to comment.