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],
)
| 533 | @add_click_logging_options |
| 534 | @PublicAPI(stability="stable") |
| 535 | def 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() |
nothing calls this directly
no test coverage detected
searching dependent graphs…