-
Notifications
You must be signed in to change notification settings - Fork 67
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
Override cache dir if PYENSEMBL_CACHE_DIR is set #156
Conversation
@@ -111,8 +112,12 @@ def __init__( | |||
annotation_name=annotation_name, | |||
annotation_version=annotation_version) | |||
|
|||
self._cache_directory_path = datacache.get_data_dir( | |||
subdir=self.cache_subdirectory) | |||
if environ.get(ENV_KEY) is None: |
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.
Isn't the if
handled by datacache
?
https://github.com/hammerlab/datacache/blob/master/datacache/common.py#L29-L33
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.
Correct — but I wanted to make this more explicit as it is not apparent from the function call what will happen if you pass both variables.
Actually, maybe adding a comment there to explain this might be better. Let me do that 👍
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.
done
2847d76
to
df22255
Compare
self._cache_directory_path = datacache.get_data_dir( | ||
subdir=self.cache_subdirectory) | ||
subdir=self.cache_subdirectory, |
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.
nit: indentation
LGTM! |
from os.path import join, exists, split, abspath | ||
from shutil import copy2, rmtree | ||
import logging | ||
|
||
import datacache | ||
|
||
CACHE_BASE_SUBDIR = "pyensembl" | ||
ENV_KEY = "PYENSEMBL_CACHE_DIR" |
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.
nit: might call this something a bit clearer and non-abbreviated like CACHE_DIRECTORY_ENVIRONMENT_VARIABLE
thanks all! Addressed your comments in my amended commit. Will merge and release on 💚 |
Fixes #145 |
so that we can write the cache to a shared directory when running analyses on multi-node clusters.
Context: hammerlab/biokepi#268
cc: @arahuja and @seb
This change is![Reviewable](https://camo.githubusercontent.com/23b05f5fb48215c989e92cc44cf6512512d083132bd3daf689867c8d9d386888/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)