|
67 | 67 | :py:class:`~bids.layout.BIDSLayout`, etc.) |
68 | 68 |
|
69 | 69 | """ |
| 70 | +import os |
70 | 71 | from multiprocessing import set_start_method |
71 | 72 |
|
| 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" |
72 | 77 |
|
73 | 78 | try: |
74 | 79 | set_start_method('forkserver') |
|
77 | 82 | finally: |
78 | 83 | # Defer all custom import for after initializing the forkserver and |
79 | 84 | # ignoring the most annoying warnings |
80 | | - import os |
81 | 85 | import sys |
82 | 86 | import random |
83 | 87 |
|
|
110 | 114 |
|
111 | 115 | DEFAULT_MEMORY_MIN_GB = 0.01 |
112 | 116 |
|
| 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 |
113 | 127 | _exec_env = os.name |
114 | 128 | _docker_ver = None |
115 | 129 | # special variable set in the container |
@@ -244,8 +258,6 @@ class nipype(_Config): |
244 | 258 |
|
245 | 259 | crashfile_format = 'txt' |
246 | 260 | """The file format for crashfiles, either text or pickle.""" |
247 | | - disable_telemetry = bool(os.getenv("NIPYPE_NO_ET") is None) |
248 | | - """Disable interface telemetry""" |
249 | 261 | get_linked_libs = False |
250 | 262 | """Run NiPype's tool to enlist linked libraries for every interface.""" |
251 | 263 | memory_gb = None |
@@ -295,12 +307,6 @@ def init(cls): |
295 | 307 | }) |
296 | 308 | ncfg.enable_resource_monitor() |
297 | 309 |
|
298 | | - if not cls.disable_telemetry: |
299 | | - # check for latest version |
300 | | - from nipype import check_latest_version |
301 | | - check_latest_version() |
302 | | - os.environ["NIPYPE_NO_ET"] = "1" |
303 | | - |
304 | 310 | # Nipype config (logs and execution) |
305 | 311 | ncfg.update_config({ |
306 | 312 | 'execution': { |
|
0 commit comments