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)
| 400 | |
| 401 | |
| 402 | def _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 | |
| 438 | def show_usage_stats_prompt(cli: bool) -> None: |
no test coverage detected
searching dependent graphs…