MCPcopy
hub / github.com/ray-project/ray / get_job_id

Method get_job_id

python/ray/runtime_context.py:62–80  ·  view source on GitHub ↗

Get current job ID for this worker or driver. Job ID is the id of your Ray drivers that create tasks or actors. Returns: If called by a driver, this returns the job ID. If called in a task, return the job ID of the associated driver. The job ID w

(self)

Source from the content-addressed store, hash-verified

60 return job_id
61
62 def get_job_id(self) -> str:
63 """Get current job ID for this worker or driver.
64
65 Job ID is the id of your Ray drivers that create tasks or actors.
66
67 Returns:
68 If called by a driver, this returns the job ID. If called in
69 a task, return the job ID of the associated driver. The
70 job ID will be hex format.
71
72 Raises:
73 RuntimeError: If Ray has not been initialized.
74 """
75 if not ray.is_initialized():
76 raise RuntimeError(
77 "Job ID is not available because Ray has not been initialized."
78 )
79 job_id = self.worker.current_job_id
80 return job_id.hex()
81
82 @property
83 @Deprecated(message="Use get_node_id() instead", warning=True)

Callers 1

write_logMethod · 0.45

Calls 2

is_initializedMethod · 0.45
hexMethod · 0.45

Tested by 1

write_logMethod · 0.36