ray.job_submission.JobSubmissionClient.tail_job_logs#

async JobSubmissionClient.tail_job_logs(job_id: str) AsyncIterator[str][source]#

Get an iterator that follows the logs of a job.

Example

>>> from ray.job_submission import JobSubmissionClient
>>> client = JobSubmissionClient("http://127.0.0.1:8265")
>>> submission_id = client.submit_job(
...     entrypoint="echo hi && sleep 5 && echo hi2")
>>> async for lines in client.tail_job_logs(
...           'raysubmit_Xe7cvjyGJCyuCvm2'):
...     print(lines, end="")
hi
hi2
Parameters:

job_id – The job ID or submission ID of the job whose logs are being requested.

Yields:

str – Successive chunks of the job’s stdout/stderr as the driver process produces them.

Raises:

RuntimeError – If the job does not exist, if the request to the job server fails, or if the connection closes unexpectedly before the job reaches a terminal state.