-
Notifications
You must be signed in to change notification settings - Fork 530
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
ENH: Delay etelemetry for non-interactive sessions, report bad versions #3049
Conversation
ENH: Run memoized check_version at REPL import, Node/Workflow/Interface init
Codecov Report
@@ Coverage Diff @@
## master #3049 +/- ##
==========================================
+ Coverage 67.72% 67.72% +<.01%
==========================================
Files 344 344
Lines 44087 44108 +21
Branches 5554 5562 +8
==========================================
+ Hits 29856 29872 +16
- Misses 13465 13470 +5
Partials 766 766
Continue to review full report at Codecov.
|
* upstream/master: FIX: Handle missing paths better pre-3.6 RF: Provide functions to augment old Path.mkdir, Path.resolve methods
nipype/__init__.py
Outdated
def sys_based_cache(condition): | ||
def decorator(func): | ||
if condition: | ||
return func |
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 means that if somebody's using Python 2, we're going to ping on every version. Since we're only worrying about one function with one boolean argument for a couple more releases, we can do a very quick-and-dirty memoization:
class _memoize(object):
def __init__(self, func):
self.cache = {}
self.func = func
def __call__(self, *args, **kwargs):
argtuple = (args,) + tuple(kwargs.items())
if argtuple not in self.cache:
self.cache[argtuple] = self.func(*args, **kwargs)
return self.cache[argtuple]
Another option is to manage a global state ourselves
etelemetry_results = {}
def check_latest_version(raise_exception=False):
if raise_exception not in etelemetry_results:
... # Current function
etelemetry_results[raise_exception] = latest
return etelemetry_results[raise_exception]
Or we could use something like memoization, which is surely a big hammer, but won't add code that will be most sensibly removed in two months.
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.
Sorry, thinko. That should be "ping on every interface/node/workflow instantiation", in case your brain didn't make the leap. I think it's a pretty major drawback, although I don't know how many Python 2 users we still have.
the failing test is #3046 we should merge this in before a release - and also fix up the bad_versions keys |
* upstream/master: rf: clean up test tst: create data directory prior to datalad install
* upstream/master: tst: use pytest fixture
* upstream/master: TEST: Mark test_dcm2niix_dti XFAIL
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.
LGTM. Is this ready to go?
{ "bad_versions" : [ "1.2.1", | ||
"1.2.3"] |
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 should be checked and updated before release.
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 think these are legitimately buggy. We can really only plausibly check back to 1.3.0, since this functionality will be missing before that. Is it worth looking for critical bugs in earlier release logs?
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 was more about whether even these two were correct. from a usage perspective, nothing will change till the server starts reading these .et
files and returning the info. i'll update the server soon.
|
Summary
Improves version checking
this will require the server to support the .et file in a project directory
List of changes proposed in this PR (pull-request)
Acknowledgment