Skip to content
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: add telemetry to nipype #3027

Merged
merged 3 commits into from Sep 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 16 additions & 0 deletions nipype/__init__.py
Expand Up @@ -22,7 +22,9 @@

config = NipypeConfig()
logging = Logging(config)
logger = logging.getLogger('nipype.utils')

INIT_MSG = "Running {packname} version {version} (latest: {latest})".format

class NipypeTester(object):
def __call__(self, doctests=True, parallel=False):
Expand Down Expand Up @@ -56,3 +58,17 @@ def get_info():
from .pipeline import Node, MapNode, JoinNode, Workflow
from .interfaces import (DataGrabber, DataSink, SelectFiles, IdentityInterface,
Rename, Function, Select, Merge)


if config.getboolean('execution', 'check_version'):
import etelemetry

latest = {"version": 'Unknown'}
try:
latest = etelemetry.get_project("nipy/nipype")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mgxd @satra It looks like etelemetry lets us send arbitrary kwargs. Should we add version information, so we can get a sense of which versions are still in use? e.g.,

latest = etelemetry.get_project("nipy/nipype", version=__version__)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that was intended to allow altering any requests specific arguments (such as timeout), but we could leverage params to do this.

except Exception as e:
logger.warning("Could not check for version updates: \n%s", e)
finally:
logger.info(INIT_MSG(packname='nipype',
version=__version__,
latest=latest["version"]))
3 changes: 2 additions & 1 deletion nipype/info.py
Expand Up @@ -164,7 +164,8 @@ def get_nipype_gitversion():
'scipy>=%s,<%s ; python_version <= "3.4"' % (SCIPY_MIN_VERSION, SCIPY_MAX_VERSION_34),
'simplejson>=%s' % SIMPLEJSON_MIN_VERSION,
'traits>=%s,!=5.0' % TRAITS_MIN_VERSION,
'filelock>=3.0.0'
'filelock>=3.0.0',
'etelemetry',
]

# neurdflib has to come after prov
Expand Down
1 change: 1 addition & 0 deletions nipype/utils/config.py
Expand Up @@ -68,6 +68,7 @@
parameterize_dirs = true
poll_sleep_duration = 2
xvfb_max_wait = 10
check_version = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a new entry in the documentation for this new option?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currently this is only at: https://miykael.github.io/nipype_tutorial/notebooks/basic_execution_configuration.html

i'll send a PR there as well.


[monitoring]
enabled = false
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Expand Up @@ -17,3 +17,4 @@ scipy>=0.14
simplejson>=3.8.0
traits>=4.6
filelock>= 3.0.0
etelemetry