MCPcopy
hub / github.com/ray-project/ray / record_library_usage

Function record_library_usage

python/ray/_common/usage/usage_lib.py:277–296  ·  view source on GitHub ↗

Record library usage (e.g. which library is used)

(library_usage: str)

Source from the content-addressed store, hash-verified

275
276
277def record_library_usage(library_usage: str):
278 """Record library usage (e.g. which library is used)"""
279 with _recorded_library_usages_lock:
280 if library_usage in _recorded_library_usages:
281 return
282 _recorded_library_usages.add(library_usage)
283
284 if not _internal_kv_initialized():
285 # This happens if the library is imported before ray.init
286 return
287
288 # Only report lib usage for driver / ray client / workers. Otherwise,
289 # it can be reported if the library is imported from
290 # e.g., API server.
291 if (
292 ray._private.worker.global_worker.mode == ray.SCRIPT_MODE
293 or ray._private.worker.global_worker.mode == ray.WORKER_MODE
294 or ray.util.client.ray.is_connected()
295 ):
296 _put_library_usage(library_usage)
297
298
299def _put_pre_init_library_usages():

Callers 3

__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90

Calls 4

_internal_kv_initializedFunction · 0.90
_put_library_usageFunction · 0.85
addMethod · 0.45
is_connectedMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…