Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed schema refs for ml.yaml #489

Merged
merged 7 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 24 additions & 8 deletions spec/namespaces/ml.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,36 +130,52 @@ components:
ml.search_models:
content:
application/json:
$ref: '../schemas/ml._common.yaml#/components/schemas/SearchModelsQuery'
schema:
$ref: '../schemas/ml._common.yaml#/components/schemas/SearchModelsQuery'
responses:
ml.register_model_group@200:
content:
application/json:
$ref: '../schemas/ml._common.yaml#/components/schemas/ModelGroupRegistration'
schema:
$ref: '../schemas/ml._common.yaml#/components/schemas/ModelGroupRegistration'
ml.get_model_group@200:
content:
application/json:
$ref: '../schemas/ml._common.yaml#/components/schemas/ModelGroup'
schema:
$ref: '../schemas/ml._common.yaml#/components/schemas/ModelGroup'
ml.delete_model_group@200:
content:
application/json:
$ref: '../schemas/ml._common.yaml#/components/schemas/ModelGroup'
schema:
$ref: '../schemas/_common.yaml#/components/schemas/WriteResponseBase'
ml.register_model@200:
content:
application/json:
$ref: '../schemas/ml._common.yaml#/components/schemas/Task'
schema:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this not a task? In tests we register a model then wait it the task to complete.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The response is not the entire Task object, which is different from get_task's response. This only returns the task_id for you to check on it later.

type: object
properties:
status:
type: string
task_id:
type: string
required:
- status
- task_id
ml.delete_model@200:
content:
application/json:
$ref: '../schemas/ml._common.yaml#/components/schemas/ModelGroup'
schema:
$ref: '../schemas/_common.yaml#/components/schemas/WriteResponseBase'
ml.get_task@200:
content:
application/json:
$ref: '../schemas/ml._common.yaml#/components/schemas/Task'
schema:
$ref: '../schemas/ml._common.yaml#/components/schemas/Task'
ml.search_models@200:
content:
application/json:
$ref: '../schemas/ml._common.yaml#/components/schemas/SearchModelsResponse'
schema:
$ref: '../schemas/ml._common.yaml#/components/schemas/SearchModelsResponse'
parameters:
ml.get_model_group::path.model_group_id:
name: model_group_id
Expand Down
5 changes: 3 additions & 2 deletions spec/schemas/ml._common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ components:
properties:
model_id:
type: string
description: The model ID.
task_id:
type: string
state:
type: string
description: The state.
enum:
- CANCELLED
- COMPLETED
Expand All @@ -124,6 +124,7 @@ components:
description: Task type.
enum:
- DEPLOY_MODEL
- REGISTER_MODEL
function_name:
type: string
worker_node:
Expand Down
18 changes: 13 additions & 5 deletions tests/default/ml/models.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ prologues:
ml_commons:
only_run_on_ml_node: false
chapters:
- synopsis: Create model.
id: create_model
- synopsis: Register model.
id: register_model
path: /_plugins/_ml/models/_register
method: POST
request:
Expand All @@ -25,17 +25,25 @@ chapters:
status: 200
output:
task_id: payload.task_id
- synopsis: Wait for task.
- synopsis: Wait to get completed task.
id: get_completed_task
path: /_plugins/_ml/tasks/{task_id}
method: GET
warnings:
multiple-paths-detected: false
parameters:
task_id: ${create_model.task_id}
task_id: ${register_model.task_id}
response:
status: 200
payload:
state: COMPLETED
output:
model_id: payload.model_id
retry:
count: 3
count: 5
wait: 30000
- synopsis: Delete model.
path: /_plugins/_ml/models/{model_id}
parameters:
model_id: ${get_completed_task.model_id}
method: DELETE
Loading