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

Provide interface method to get actual path/URL on backend? #221

Open
hagenw opened this issue Apr 22, 2024 · 1 comment
Open

Provide interface method to get actual path/URL on backend? #221

hagenw opened this issue Apr 22, 2024 · 1 comment
Labels
question Further information is requested

Comments

@hagenw
Copy link
Member

hagenw commented Apr 22, 2024

In some packages we provided a method to get the actual path of a file on the backend, which might be useful to navigate to the file or download it directly, e.g. audmodel.url().

For the two backends we have at the moment, this can be achieved with (when using an interface that versions files):

  • FileSystem: interface.join(interface.backend._root, interface._path_with_version(path, version))
  • Artifactory: str(interface.backend.path(interface._path_with_version(path, version)))

This has a few problems though:

  • the actual path depends on the used backend and interface, which means it doesn't seem like a good idea to rely on private methods
  • their might be backends, where we don't can provide a meaningful URL/root path
@hagenw hagenw added the question Further information is requested label Apr 22, 2024
@frankenjoe
Copy link
Collaborator

their might be backends, where we don't can provide a meaningful URL/root path

Yes, that's why we removed Backend.path in #47.

Probably the simplest solution would be to add an optional return argument to Backend.put_file(). Backends like FileSystem and Artifactory can use it to return the path on the backend. But other backends, like the SQL backend in the documentation, may also return None.

The other, more complex solution I see, is that we add a method to Backend and Interface that translates a virtual backend path to its "real" path. But again the return value can be Noneas it may not make sense on all backends.

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

No branches or pull requests

2 participants