Skip to content

Commit e5c0830

Browse files
authored
Merge pull request #2168 from mgxd/fix/nipype-et
ENH: Ensure nipype telemetry is just pinged once
2 parents b6267a6 + d54925f commit e5c0830

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

fmriprep/config.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,13 @@
6767
:py:class:`~bids.layout.BIDSLayout`, etc.)
6868
6969
"""
70+
import os
7071
from multiprocessing import set_start_method
7172

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

7378
try:
7479
set_start_method('forkserver')
@@ -77,7 +82,6 @@
7782
finally:
7883
# Defer all custom import for after initializing the forkserver and
7984
# ignoring the most annoying warnings
80-
import os
8185
import sys
8286
import random
8387

@@ -110,6 +114,16 @@
110114

111115
DEFAULT_MEMORY_MIN_GB = 0.01
112116

117+
# Ping NiPype eTelemetry once if env var was not set
118+
# workers on the pool will have the env variable set from the master process
119+
if not _disable_et:
120+
# Just get so analytics track one hit
121+
from contextlib import suppress
122+
from requests import get as _get_url, ConnectionError, ReadTimeout
123+
with suppress((ConnectionError, ReadTimeout)):
124+
_get_url("https://rig.mit.edu/et/projects/nipy/nipype", timeout=0.05)
125+
126+
# Execution environment
113127
_exec_env = os.name
114128
_docker_ver = None
115129
# special variable set in the container
@@ -303,6 +317,7 @@ def init(cls):
303317
'crashfile_format': cls.crashfile_format,
304318
'get_linked_libs': cls.get_linked_libs,
305319
'stop_on_first_crash': cls.stop_on_first_crash,
320+
'check_version': False, # disable future telemetry
306321
}
307322
})
308323

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ install_requires =
3333
psutil >= 5.4
3434
pybids >= 0.10.2
3535
pyyaml
36+
requests
3637
sdcflows ~= 1.3.1
3738
smriprep ~= 0.6.1
3839
tedana >= 0.0.9a1, < 0.0.10

0 commit comments

Comments
 (0)