ray.util.state.get_task(id: str | ray._raylet.ObjectRef, address: str | None = None, timeout: int = 30, _explain: bool = False) TaskState | None[source]#

Get task attempts of a task by id.

  • id – String id of the task or ObjectRef that corresponds to task

  • address – Ray bootstrap address, could be auto, localhost:6379. If None, it will be resolved automatically from an initialized ray.

  • timeout – Max timeout value for the state APIs requests made.

  • _explain – Print the API information such as API latency or failed query information.


None if task not found, or a list of TaskState from the task attempts.


RayStateApiException – if the CLI failed to query the data.

DeveloperAPI: This API may change across minor Ray releases.