ray.experimental.state.api.get_log
ray.experimental.state.api.get_log#
- ray.experimental.state.api.get_log(address: Optional[str] = None, node_id: Optional[str] = None, node_ip: Optional[str] = None, filename: Optional[str] = None, actor_id: Optional[str] = None, task_id: Optional[str] = None, pid: Optional[int] = None, follow: bool = False, tail: int = 1000, timeout: int = 30, suffix: Optional[str] = None, _interval: Optional[float] = None) Generator[str, None, None] [source]#
Retrieve log file based on file name or some entities ids (pid, actor id, task id).
Examples
>>> import ray >>> from ray.experimental.state.api import get_log # To connect to an existing ray instance if there is >>> ray.init("auto") # Node IP could be retrieved from list_nodes() or ray.nodes() >>> node_ip = "172.31.47.143" >>> filename = "gcs_server.out" >>> for l in get_log(filename=filename, node_ip=node_ip): >>> print(l)
- Parameters
address – Ray bootstrap address, could be
auto
,localhost:6379
. If not specified, it will be retrieved from the initialized ray cluster.node_id – Id of the node containing the logs .
node_ip – Ip of the node containing the logs. (At least one of the node_id and node_ip have to be supplied when identifying a node).
filename – Name of the file (relative to the ray log directory) to be retrieved.
actor_id – Id of the actor if getting logs from an actor.
task_id – Id of the task if getting logs generated by a task.
pid – PID of the worker if getting logs generated by a worker. When querying with pid, either node_id or node_ip must be supplied.
follow – When set to True, logs will be streamed and followed.
tail – Number of lines to get from the end of the log file. Set to -1 for getting the entire log.
timeout – Max timeout for requests made when getting the logs.
suffix – The suffix of the log file if query by id of tasks/workers/actors.
_interval – The interval in secs to print new logs when
follow=True
.
- Returns
A Generator of log line, None for SendType and ReturnType.
- Raises
Exceptions –
RayStateApiException
if the CLI failed to query the data.