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: set non-empty modelPath for http storageURI #382

Merged
merged 4 commits into from
Jun 2, 2023

Conversation

tjohnson31415
Copy link
Contributor

Motivation

When using the storageURI form of an HTTP (non Azure blob) address to download a model, the modelPath needs to be an non-empty string. Before this change, the storageURI: http://models.r.us/my-model.json form would be equivalent to the following storage spec:

storage:
  type: http
  path: ''    # this being empty is problematic for later processing
  parameters:
    url: http://models.r.us/path/to/my-model.json      

The http storage type is currently the only way to have a valid storage configuration with an empty path (mainly because it has a "url" parameter that could include the full path). That said, I'm not sure if we should make a path required for the HTTP storage type. In particular, if the url is just http://models.r.us/, there is no path portion.

Related: kserve/modelmesh-runtime-adapter#41 (comment)

Modifications

Set modelPath to the URL's Path and set the url parameter to not have the URL Path.

Result

With these changes, the storageURI example above changes to have a path field:

storage:
  type: http
  path: path/to/my-model.json
  parameters:
    url: http://models.r.us/

@ckadner ckadner added this to the v0.11.0 milestone May 31, 2023
@ckadner ckadner self-assigned this May 31, 2023
@tjohnson31415
Copy link
Contributor Author

The changes in this PR are dependent on a fix in kserve/modelmesh-runtime-adapter#52 to not duplicate the "local path" for the downloaded file. Using the example from the issue description, without the fix in kserve/modelmesh-runtime-adapter#52, the file will be downloaded as my-model.json/my-model.json.

@ckadner
Copy link
Member

ckadner commented Jun 1, 2023

I created a small FVT test case for this. I was about to push it to your branch assuming you will be away for a while.

Do you mind me adding it to your PR, or did you already have one ready?

@ckadner ckadner requested review from ckadner and njhill and removed request for joerunde and rafvasq June 1, 2023 20:34
kserve-oss-bot pushed a commit to kserve/modelmesh-runtime-adapter that referenced this pull request Jun 1, 2023
#### Motivation

Removes some buggy behavior related to the handling of an empty `modelPath` being passed into the puller

#### Modifications

- use `filepath.Join()` instead of manual string concatenation with the file separator to handle an empty `modelPathFilename`
-  in the http storageProvider, remove duplication of the `localPath` into the rendered path
     - just to not it: I think this bug has not been caught because using the HTTP provider with a `storageURI` means that the local path is empty
      - this will need to be fixed before kserve/modelmesh-serving#382 can be merged
- add check to ensure that the local path for files downloaded by the puller is always a path within the generated model dir (prevents the generated dir name from being the model file as was seen in #41 (comment))
    - if no path is extracted from the request `ModelPath`, use `_model` by default

#### Result

Resolves: #41


Signed-off-by: Travis Johnson <[email protected]>
Signed-off-by: Christian Kadner <[email protected]>
@ckadner
Copy link
Member

ckadner commented Jun 1, 2023

I created a small FVT test case for this. I was about to push it to your branch assuming you will be away for a while.

The new FVT failed, before the dependent PR kserve/modelmesh-runtime-adapter#52 got merged / image build and pushed. As expected.

https://github.com/kserve/modelmesh-serving/actions/runs/5150015048/jobs/9273693622?pr=382#step:15:3366

Summarizing 1 Failure:
  [FAIL] ISVCs with HTTPS storage URI [It] should successfully load a model
  /home/runner/work/modelmesh-serving/modelmesh-serving/fvt/helpers.go:296
      Last Failure Info:
        Location:             7b8767-7wq2t
        Message:              INTERNAL: Failed to load Model due to MLServer runtime error: rpc error: code = Internal desc = builtins.IsADirectoryError: [Errno 21] Is a directory: '/models/_mlserver_models/isvc-https-x26xk__isvc-0ca2192877/mnist-svm.joblib'
        Model Revision Name:  isvc-https-x26xk__isvc-0ca2192877
        Reason:               ModelLoadFailed
        Time:                 2023-06-01T23:24:07Z

I will kick off another run after the modelmesh-runtime-adapter image was build and pushed to DockerHub

@ckadner
Copy link
Member

ckadner commented Jun 2, 2023

The FVT completed successfully after the modelmesh-runtime-adapter image was built and pushed to DockerHub

https://github.com/kserve/modelmesh-serving/actions/runs/5150015048/jobs/9274211815#step:15:2367

------------------------------
• [2.413 seconds]
ISVCs with HTTPS storage URI should successfully load a model
/home/runner/work/modelmesh-serving/modelmesh-serving/fvt/storage/storage_test.go:59

  Timeline >>
  STEP: Creating inference service isvc-https-z7s2q @ 06/02/23 00:02:40.939
  STEP: Waiting for inference service isvc-https-z7s2q to be 'Ready' and model is 'Loaded' @ 06/02/23 00:02:40.953
  << Timeline
------------------------------
• [0.063 seconds]
ISVCs with HTTPS storage URI should successfully run inference
/home/runner/work/modelmesh-serving/modelmesh-serving/fvt/storage/storage_test.go:65

  Timeline >>
  2023-06-02T00:02:43Z	INFO	Deleting inference services isvc-https-z7s2q
  << Timeline
------------------------------

@ckadner ckadner marked this pull request as ready for review June 2, 2023 00:13
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.

Thank you @tjohnson31415 for working on these two fixes despite being on leave!

/lgtm

@kserve-oss-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

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

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 4a47d56 into kserve:main Jun 2, 2023
lgdeloss pushed a commit to lgdeloss/modelmesh-serving that referenced this pull request Jun 5, 2023
#### Motivation

When using the `storageURI` form of an HTTP (non Azure blob) address to download a model, the `modelPath` needs to be an non-empty string. Before this change, the `storageURI: http://models.r.us/my-model.json` form would be equivalent to the following `storage` spec:
```
storage:
  type: http
  path: ''    # this being empty is problematic for later processing
  parameters:
    url: http://models.r.us/path/to/my-model.json
```

The http storage type is currently the only way to have a valid storage configuration with an empty `path` (mainly because it has a "url" parameter that could include the full path). That said, I'm not sure if we should make a `path` required for the HTTP storage type. In particular, if the `url` is just `http://models.r.us/`, there is no path portion.

Related: kserve/modelmesh-runtime-adapter#41 (comment)

#### Modifications

Set `modelPath` to the URL's Path and set the `url` parameter to not have the URL Path.

#### Result

With these changes, the `storageURI` example above changes to have a `path` field:

```
storage:
  type: http
  path: path/to/my-model.json
  parameters:
    url: http://models.r.us/
```

Signed-off-by: Travis Johnson <[email protected]>
Signed-off-by: Christian Kadner <[email protected]>

Co-authored-by: Christian Kadner <[email protected]>
Signed-off-by: Luis Delossantos <[email protected]>
lgdeloss pushed a commit to lgdeloss/modelmesh-serving that referenced this pull request Jun 6, 2023
#### Motivation

When using the `storageURI` form of an HTTP (non Azure blob) address to download a model, the `modelPath` needs to be an non-empty string. Before this change, the `storageURI: http://models.r.us/my-model.json` form would be equivalent to the following `storage` spec:
```
storage:
  type: http
  path: ''    # this being empty is problematic for later processing
  parameters:
    url: http://models.r.us/path/to/my-model.json
```

The http storage type is currently the only way to have a valid storage configuration with an empty `path` (mainly because it has a "url" parameter that could include the full path). That said, I'm not sure if we should make a `path` required for the HTTP storage type. In particular, if the `url` is just `http://models.r.us/`, there is no path portion.

Related: kserve/modelmesh-runtime-adapter#41 (comment)

#### Modifications

Set `modelPath` to the URL's Path and set the `url` parameter to not have the URL Path.

#### Result

With these changes, the `storageURI` example above changes to have a `path` field:

```
storage:
  type: http
  path: path/to/my-model.json
  parameters:
    url: http://models.r.us/
```

Signed-off-by: Travis Johnson <[email protected]>
Signed-off-by: Christian Kadner <[email protected]>

Co-authored-by: Christian Kadner <[email protected]>
Signed-off-by: Luis Delossantos <[email protected]>
@tjohnson31415 tjohnson31415 deleted the fix-http-modelpath branch September 5, 2023 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

v0.11.0: Model directory creation and loading error
3 participants