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

Document that local_folder is expected to be an absolute path #218

Open
jklaise opened this issue Mar 25, 2022 · 0 comments
Open

Document that local_folder is expected to be an absolute path #218

jklaise opened this issue Mar 25, 2022 · 0 comments

Comments

@jklaise
Copy link
Contributor

jklaise commented Mar 25, 2022

In the examples, the following pattern is observed for specifying the local artifacts folder:

ARTIFACTS_FOLDER = os.getcwd()+"/artifacts"

Note that if the os.getcwd() call is ommited, the example will work locally (within the Python process), but fail to deploy on Docker with an error message which is not very transparent:

FileNotFoundError: [Errno 2] No such file or directory: '/mnt/models/model.pickle'

This leads me to believe that an absolute path is necessary for deployments to work. If that is the case, this should be documented in the Model class and model decorator docstrings as well as in the docs more prominently (maybe a warning box?). To make the user experience even better, we could also consider the following:

  • convert relative paths to absolute ones (if no intended side-effects)
  • issue a warning if the path is relative and/or propagate the error with a custom message so the FileNotFoundError is more informative

Finally, perhaps we could think about accepting pathlib.Path objects anywhere we accept strings that represent paths? This would avoid many common mistakes when constructing paths "by hand" and could be more platform-agnostic.

Potentially related issue: #94.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant