ray.runtime_context.get_runtime_context#

ray.runtime_context.get_runtime_context() RuntimeContext[source]#

Get the runtime context of the current driver/worker.

The obtained runtime context can be used to get the metadata of the current task and actor.

Example

import ray
# Get the job id.
ray.get_runtime_context().get_job_id()
# Get the actor id.
ray.get_runtime_context().get_actor_id()
# Get the task id.
ray.get_runtime_context().get_task_id()