Skip to content

Commit

Permalink
Merge pull request #2168 from mgxd/fix/nipype-et
Browse files Browse the repository at this point in the history
ENH: Ensure nipype telemetry is just pinged once
  • Loading branch information
oesteban committed Jun 4, 2020
2 parents b6267a6 + d54925f commit e5c0830
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
17 changes: 16 additions & 1 deletion fmriprep/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,13 @@
:py:class:`~bids.layout.BIDSLayout`, etc.)
"""
import os
from multiprocessing import set_start_method

# Disable NiPype etelemetry always
_disable_et = bool(os.getenv("NO_ET") is not None or os.getenv("NIPYPE_NO_ET") is not None)
os.environ["NIPYPE_NO_ET"] = "1"
os.environ["NO_ET"] = "1"

try:
set_start_method('forkserver')
Expand All @@ -77,7 +82,6 @@
finally:
# Defer all custom import for after initializing the forkserver and
# ignoring the most annoying warnings
import os
import sys
import random

Expand Down Expand Up @@ -110,6 +114,16 @@

DEFAULT_MEMORY_MIN_GB = 0.01

# Ping NiPype eTelemetry once if env var was not set
# workers on the pool will have the env variable set from the master process
if not _disable_et:
# Just get so analytics track one hit
from contextlib import suppress
from requests import get as _get_url, ConnectionError, ReadTimeout
with suppress((ConnectionError, ReadTimeout)):
_get_url("https://rig.mit.edu/et/projects/nipy/nipype", timeout=0.05)

# Execution environment
_exec_env = os.name
_docker_ver = None
# special variable set in the container
Expand Down Expand Up @@ -303,6 +317,7 @@ def init(cls):
'crashfile_format': cls.crashfile_format,
'get_linked_libs': cls.get_linked_libs,
'stop_on_first_crash': cls.stop_on_first_crash,
'check_version': False, # disable future telemetry
}
})

Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ install_requires =
psutil >= 5.4
pybids >= 0.10.2
pyyaml
requests
sdcflows ~= 1.3.1
smriprep ~= 0.6.1
tedana >= 0.0.9a1, < 0.0.10
Expand Down

0 comments on commit e5c0830

Please sign in to comment.