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

Function _generate_cluster_metadata

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

Return a dictionary of cluster metadata. Params: ray_init_cluster: Whether the cluster is started by ray.init() Returns: A dictionary of cluster metadata.

(*, ray_init_cluster: bool)

Source from the content-addressed store, hash-verified

400
401
402def _generate_cluster_metadata(*, ray_init_cluster: bool):
403 """Return a dictionary of cluster metadata.
404
405 Params:
406 ray_init_cluster: Whether the cluster is started by ray.init()
407
408 Returns:
409 A dictionary of cluster metadata.
410 """
411 ray_version, python_version = ray._private.utils.compute_version_info()
412 # These two metadata is necessary although usage report is not enabled
413 # to check version compatibility.
414 metadata = {
415 "ray_version": ray_version,
416 "python_version": python_version,
417 "ray_init_cluster": ray_init_cluster,
418 }
419 # Additional metadata is recorded only when usage stats are enabled.
420 if usage_stats_enabled():
421 metadata.update(
422 {
423 "git_commit": ray.__commit__,
424 "os": sys.platform,
425 "session_start_timestamp_ms": int(time.time() * 1000),
426 }
427 )
428 if sys.platform == "linux":
429 # Record llibc version
430 (lib, ver) = platform.libc_ver()
431 if not lib:
432 metadata.update({"libc_version": "NA"})
433 else:
434 metadata.update({"libc_version": f"{lib}:{ver}"})
435 return metadata
436
437
438def show_usage_stats_prompt(cli: bool) -> None:

Callers 1

put_cluster_metadataFunction · 0.85

Calls 3

usage_stats_enabledFunction · 0.85
updateMethod · 0.45
timeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…