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

Function logs

python/ray/dashboard/modules/job/cli.py:535–569  ·  view source on GitHub ↗

Gets the logs of a job. Example: `ray job logs ` Args: address: Address of the Ray cluster to connect to. job_id: The submission ID of the job whose logs to fetch. follow: If True, stream the logs (``tail -f`` style) instead of printing them once.

(
    address: Optional[str],
    job_id: str,
    follow: bool,
    headers: Optional[str],
    verify: Union[bool, str],
)

Source from the content-addressed store, hash-verified

533@add_click_logging_options
534@PublicAPI(stability="stable")
535def logs(
536 address: Optional[str],
537 job_id: str,
538 follow: bool,
539 headers: Optional[str],
540 verify: Union[bool, str],
541):
542 """Gets the logs of a job.
543
544 Example:
545 `ray job logs <my_job_id>`
546
547 Args:
548 address: Address of the Ray cluster to connect to.
549 job_id: The submission ID of the job whose logs to fetch.
550 follow: If True, stream the logs (``tail -f`` style) instead of printing them once.
551 headers: JSON string of headers to attach to requests.
552 verify: Path to a CA bundle, or boolean toggling TLS verification.
553 """
554 client = _get_sdk_client(address, headers=headers, verify=verify)
555 sdk_version = client.get_version()
556 # sdk version 0 did not have log streaming
557 if follow:
558 if int(sdk_version) > 0:
559 get_or_create_event_loop().run_until_complete(_tail_logs(client, job_id))
560 else:
561 cli_logger.warning(
562 "Tailing logs is not enabled for the Jobs SDK client version "
563 f"{sdk_version}. Please upgrade Ray to latest version "
564 "for this feature."
565 )
566 else:
567 # Set no_format to True because the logs may have unescaped "{" and "}"
568 # and the CLILogger calls str.format().
569 cli_logger.print(client.get_job_logs(job_id), end="", no_format=True)
570
571
572@job_cli_group.command()

Callers

nothing calls this directly

Calls 7

get_or_create_event_loopFunction · 0.90
_get_sdk_clientFunction · 0.85
_tail_logsFunction · 0.85
get_versionMethod · 0.45
warningMethod · 0.45
printMethod · 0.45
get_job_logsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…