-
Notifications
You must be signed in to change notification settings - Fork 20
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
Make registry configurable #132
Make registry configurable #132
Conversation
@agitter This wound up being a bit more like open heart surgery than I anticipated. Let's discuss the approach and decide if we like doing things this way or not. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm leaving some initial thoughts. I originally didn't envision moving all of the config file to a class, but now I can see benefits to doing that.
41f9ec8
to
1313446
Compare
@agitter, I think I've covered all of the things we discussed in our last meeting, and this should more or less be ready for a final review. |
Merging #126 created merge conflicts in this pull request |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks pretty close. I added another round of comments. After those are resolved, I'll run the workflow locally to confirm everything still runs as expected.
8d2d076
to
7ecce69
Compare
The biggest change in this commit is the addition of `src/config.py`, which acts as a singleton module to pass global configs around SPRAS. When the Snakefile is run, it uses it's magically available `config` to instantiate the config object in the config module. After instantiation, other modules can `import src.config as config`, which allows them to access various config parameters. For example, to access the container framework, you can do: ``` import src.config as config framework = config.config.framework ``` In addition to modularizing configuration, I also added the ability to specify container registries and owners in the config. A full container name looks like `docker.io/reedcompbio/pathlinker:latest`. The config option considers docker.io the base_url, reedcompbio the owner, and then pathlinker will be hardcoded by that method. Lacking in this implementation is the ability to specify exactly what tag to run each PRM against. With the new config module, that should be relatively simple to add. As far as implentation choices, since the config module makes various values globally available, I decided to stop passing some values like `singularity` down through nested levels of function calls, and instead get those values close to where they're needed.
I updated `registry` to `container_registry` in anticipation of a future where we support different data registries as well, per @agitter's suggestion. I also changed the `config.framework` variable to `config.container_framework` to be more clear what this variable is supposed to contain.
This commit moves the container framework up a level so that each algorithm is called with the configured framework instead of determining the framework internally. The logic behind this is that doing so makes testing much easier; instead of messing with global configs in the tests, just call the PRM's run function with a different framework specified. This also moves prepare_volume to `containers.py` to fix the issue with importing hash lengths in the function. Arguably, I should have moved prepare_volume into containers.py in the first place.
b24ed46
to
b6f5f58
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went through all the files again, including viewing them in my IDE. This looks very close now. The test cases pass locally, and the workflow produces expected results locally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The last commit addresses all of my previous review comments. This final suggestion addresses the new config TODO, adding comments to the class member variables describing them. I'll merge after this change is accepted.
Add mechanism for passing global configurations
The biggest change in this commit is the addition of
src/config.py
, which acts as asingleton module to pass global configs around SPRAS. When the Snakefile is run, it
uses its magically available
config
to instantiate the config object in the configmodule. After instantiation, other modules can
import src.config as config
, which allowsthem to access various config parameters. For example, to access the container framework,
you can do:
In addition to modularizing configuration, I also added the ability to specify container
registries and owners in the config. A full container name looks like
docker.io/reedcompbio/pathlinker:latest
. The config option considers docker.io the base_url,reedcompbio the owner, and then pathlinker will be hardcoded by that method. Lacking in this
implementation is the ability to specify exactly what tag to run each PRM against. With the new
config module, that should be relatively simple to add.
As far as implentation choices, since the config module makes various values globally available,
I decided to stop passing some values like
singularity
down through nested levels of functioncalls, and instead get those values close to where they're needed. The only place this was obviously
not the clean way to do this was in the tests -- for now, I toggle
config.config.framework
in theplaces where we need to test singularity.