|
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 |
@@ -303,6 +317,7 @@ def init(cls): |
303 | 317 | 'crashfile_format': cls.crashfile_format, |
304 | 318 | 'get_linked_libs': cls.get_linked_libs, |
305 | 319 | 'stop_on_first_crash': cls.stop_on_first_crash, |
| 320 | + 'check_version': False, # disable future telemetry |
306 | 321 | } |
307 | 322 | }) |
308 | 323 |
|
|
0 commit comments