generated from opensafely-core/repo-template
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Remove backend registration system #561
Comments
evansd
added a commit
that referenced
this issue
Jun 27, 2022
This fixes a [circular import][1] problem and at the same time makes it possible to use databuilder with backends definitions that aren't bundled within databuilder itself. I don't currently anticipate users needing to supply backend names themselves on the command line, so the extra verbosity shouldn't be a problem here. But if it turns out they do need to do so then we can define some short aliases for commonly used backends. Closes #561 [1]: #561
evansd
added a commit
that referenced
this issue
Jun 27, 2022
The effect of this PR is that rather than specifying a backend using an alias like: OPENSAFELY_BACKEND='tpp' The backend is instead specified using its full dotted path: OPENSAFELY_BACKEND='databuilder.backends.tpp.TPPBackend' This fixes a [circular import][1] problem, removes some code, and at the same time makes it possible to use databuilder with backends definitions that aren't bundled within databuilder itself. I don't currently anticipate users needing to supply backend names themselves on the command line, so the extra verbosity shouldn't be a problem here. But if it turns out they do need to do so then we can define a mapping of short aliases to full dotted paths for commonly used backends. Closes #561 [1]: #561
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
At present, backends define a
backend_id
and register themselves in a global dictionary so that they can be referenced by this ID in environment variables.However, this requires importing all the backends so they can register themselves. And this causes circular import problems e.g.
We should get rid of the registration system and allow the environment to specify the backend by its dotted path e.g.
As well as fixing the circular import problem and simplifying the code this naturally supports out-of-tree backends, which I think is desirable.
The text was updated successfully, but these errors were encountered: