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

fix: correct mlserver uri conversion regardless of filenames #43

Merged
merged 3 commits into from
Apr 13, 2023

Conversation

xvnyv
Copy link
Contributor

@xvnyv xvnyv commented Apr 6, 2023

Motivation

As documented in this issue, there is currently a bug in the conversion of the uri provided in the MLServer model-settings.json file if the model files are symlinked before the uri conversion occurs. This PR is intended to fix the issue by ensuring that model-settings.json will always be processed first.

Modifications

The function adaptModelLayoutForRuntime in the MLServer adapter server.go was modified to ensure that, if present, the model-settings.json file will be placed at the head of the list of files to be processed. This makes sure that the config file will always be processed before any symlinks are created for the model files.

A unit test was also added to ensure that the bug was fixed.

Result

Incorrect uri conversion bug no longer occurs even when the model files alphabetically precede the filenamemodel-settings.json.

Resolves #40

tjohnson31415
tjohnson31415 previously approved these changes Apr 6, 2023
Copy link
Contributor

@tjohnson31415 tjohnson31415 left a comment

Choose a reason for hiding this comment

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

Looks great! Thanks for reporting the bug and providing the fix plus a test case!

You'll need to follow the steps mentioned in the DCO check to sign off on the commits in the branch, but the changes LGTM!

@xvnyv xvnyv force-pushed the fix-mlserver-uri-conversion branch from c8b8242 to 1b628a1 Compare April 7, 2023 20:36
@tjohnson31415 tjohnson31415 changed the title Fix mlserver uri conversion fix: correct mlserver uri conversion regardless of filenames Apr 10, 2023
Signed-off-by: xinyitan <[email protected]>
@xvnyv
Copy link
Contributor Author

xvnyv commented Apr 11, 2023

/assign @animeshsingh

@ckadner ckadner requested review from rafvasq and ckadner and removed request for tedhtchang and Tomcli April 11, 2023 17:02
@ckadner ckadner assigned ckadner and unassigned animeshsingh Apr 11, 2023
@rafvasq rafvasq added the bug Something isn't working label Apr 11, 2023
Copy link
Member

@rafvasq rafvasq left a comment

Choose a reason for hiding this comment

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

Thanks @xvnyv! Just a nit on the model name used in the test but LGTM otherwise 👍

ModelPath: "data",
InputFiles: []string{
"data/model-settings.json",
"data/aaaaa.json",
Copy link
Member

Choose a reason for hiding this comment

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

Nit: use a more descriptive name for the model with alphabetical precedence such as a-model.json or alpha-model.json

Copy link
Member

Choose a reason for hiding this comment

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

I generally would agree, but here I think the aaaaa drives home the point of this being a alphabetical sorting related issue

Copy link
Member

Choose a reason for hiding this comment

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

Fair enough! I went back and forth on it myself and figured test case's description above it could be enough. Your call :)

Copy link
Member

@ckadner ckadner left a comment

Choose a reason for hiding this comment

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

/lgtm

@tjohnson31415
Copy link
Contributor

/approve

@kserve-oss-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ckadner, tjohnson31415, xvnyv

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kserve-oss-bot kserve-oss-bot merged commit 6a09225 into kserve:main Apr 13, 2023
Jooho referenced this pull request in Jooho/modelmesh-runtime-adapter May 1, 2023
Jooho referenced this pull request in red-hat-data-services/modelmesh-runtime-adapter May 16, 2023
…ahub-io#43)

#### Motivation

As documented in [this issue](kserve#40), there is currently a bug in the conversion of the `uri` provided in the MLServer `model-settings.json` file if the model files are symlinked before the uri conversion occurs. This PR is intended to fix the issue by ensuring that `model-settings.json` will always be processed first.

#### Modifications

The function `adaptModelLayoutForRuntime` in the MLServer adapter `server.go` was modified to ensure that, if present, the `model-settings.json` file will be placed at the head of the list of files to be processed. This makes sure that the config file will always be processed before any symlinks are created for the model files.

A unit test was also added to ensure that the bug was fixed.

#### Result

Incorrect uri conversion bug no longer occurs even when the model files alphabetically precede the filename`model-settings.json`.


Signed-off-by: xinyitan <[email protected]>

Co-authored-by: xinyitan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved bug Something isn't working lgtm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MLServer model-settings.json uri conversion
6 participants