-
Notifications
You must be signed in to change notification settings - Fork 0
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
Better authentication handling in backends #215
Conversation
a43e3da
to
683079b
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files
|
I converted back to draft, as I would first like to solve one remaining problems with the tests. |
I was able to fix the test related problems, and the pull request is again ready for review. |
We could also speed up the tests on the Artifactory backend even further by just open one connection to the server and reuse it, but I would propose to not handle this in this pull request and created #218 to track it. |
This is a great improvement and should lead to a significant speed up in |
Yes, this would also be my hope, maybe I should try to benchmark that already. |
Seems ok to me, to only add it to classes where it is actually needed. |
Co-authored-by: Johannes Wagner <[email protected]>
Co-authored-by: Johannes Wagner <[email protected]>
86624dd
to
a38aba1
Compare
Closes #161, #162
* Add class method
audbackend.backend.Artifactory.get_authentication()
This tackles #161 by providing a public class method to read authentication tokens from a config file or environment variables.
* Add
authentication
argument and attribute toaudbackend.backend.Base
This tackles #162 by adding an
authentication
argument to__init__()
,create()
, anddelete()
ofaudbackend.backend.Base
.In
audbackend.backend.FileSystem
I then do not addauthentication
as an argument to__init__()
. Don't know if it would be better to always have it, but from a user perspective I found it easier this way.* Speedup
audbackend.backend.Artifactory
audbackend.backend.Artifactory
now only applies the authentication when callingopen()
. Before it did the authentication every time a path was requested on the backend, e.g. every timebackend.exists(path)
was called. Now, we store the path to the repo inself._repo
, when callingopen()
, and can create all other paths based on top of that.When asking if 4 files exists on the backend this reduced the execution time for me from 0.872 s to 0.178 s.
I also updated the code of the
interface
test fixture intests/conftest.py
to directly delete the repository on an Artifactory backend at the end of the test without the need to first re-authenticate.Benchmark code
* Add
audbackend.backend.Artifactory.path()
Before we had
audbackend.backend.Artifactory._path()
, which was returning anartifactory.ArtifactoryPath
object that can be used to interact with the path on the backend. As this might also be helpful for a user (compare audeering/audb#386), I decided to change it into a public method.