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

Made python kfserving.storage return uri if local path exists #92

Merged
merged 5 commits into from
May 14, 2019

Conversation

Tomcli
Copy link
Member

@Tomcli Tomcli commented May 13, 2019

The current kfserving.storage implementation only takes absolute local paths. It should also apply to any relative/absolute local path that exists on the local system.


This change is Reviewable

@k8s-ci-robot
Copy link
Contributor

Hi @Tomcli. Thanks for your PR.

I'm waiting for a kubeflow member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ellistarn
Copy link
Contributor

/ok-to-test

@@ -16,7 +16,7 @@ dump(clf, 'model.joblib')
Then, we can run the Scikit-learn Server using the generated model and test for prediction. Models can be on local filesystem, S3 compatible object storage or Google Cloud Storage.

```shell
python -m sklearnserver --model_dir model.joblib --model_name svm
python -m sklearnserver --model_dir file://model.joblib --model_name svm
Copy link
Contributor

Choose a reason for hiding this comment

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

Honestly, I'd prefer if the "recommended" usage for the python server just used relative paths. This file convention is less and less common these days. I'm happy to support it, but maybe not recommend it.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can stick to "only" relative path, but relative path can start with "/" OR "."

* Local filesystem with a prefix "/"
* Local filesystem with a prefix "file://". For example:
* With absolute path: `file:///absolute/path`
* With relative path: `file://./relative/path` or `file://relative/path`
Copy link
Contributor

Choose a reason for hiding this comment

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

file://./ feels really awkward.

Copy link
Member Author

Choose a reason for hiding this comment

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

So I added back the os.path.exists case now, users can either use the file:// prefix or without any prefix.

@ellistarn
Copy link
Contributor

ellistarn commented May 14, 2019

Thanks Tommy! Sorry to thrash your implementation but it looks like I miscommunicated a bit.

I think the file:// convention is fine, but it's less and less common these days. Modern browsers support the convention, but I'm struggling to find other examples of libraries using it like this.

I'm happy to support it, but perhaps not as the recommended usage pattern as it results in somewhat awkward syntax.

@Tomcli
Copy link
Member Author

Tomcli commented May 14, 2019

Hi @ellis-bigelow, thanks for the feedback. So I added back os.path.exists and some test cases in my recent commit to also support local path without any prefix. Please let me know if you have any question.

Thanks.

@ellistarn
Copy link
Contributor

Awesome thanks.
/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ellis-bigelow

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

ellistarn pushed a commit to ellistarn/kfserving that referenced this pull request Jul 28, 2020
)

* made storage return uri if path exists and added test cases

* Update Storage with file:// prefix

* update docs regarding relative and absolute local path

* make local path also works without prefix

* add note for relative path without prefix as recommened way
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants