mirror of
https://github.com/wassname/ray.git
synced 2026-07-20 12:40:20 +08:00
[Core] Multi-tenancy: Job isolation & implement per job config (except for env variables) (#9500)
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import ray
|
||||
|
||||
|
||||
class JobConfig:
|
||||
"""A class used to store the configurations of a job.
|
||||
|
||||
Attributes:
|
||||
worker_env (dict): Environment variables to be set on worker
|
||||
processes.
|
||||
num_java_workers_per_process (int): The number of java workers per
|
||||
worker process.
|
||||
jvm_options (str[]): The jvm options for java workers of the job.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
worker_env=None,
|
||||
num_java_workers_per_process=10,
|
||||
jvm_options=None,
|
||||
):
|
||||
if worker_env is None:
|
||||
self.worker_env = dict()
|
||||
else:
|
||||
self.worker_env = worker_env
|
||||
self.num_java_workers_per_process = num_java_workers_per_process
|
||||
if jvm_options is None:
|
||||
self.jvm_options = []
|
||||
else:
|
||||
self.jvm_options = jvm_options
|
||||
|
||||
def serialize(self):
|
||||
job_config = ray.gcs_utils.JobConfig()
|
||||
for key in self.worker_env:
|
||||
job_config.worker_env[key] = self.worker_env[key]
|
||||
job_config.num_java_workers_per_process = (
|
||||
self.num_java_workers_per_process)
|
||||
job_config.jvm_options.extend(self.jvm_options)
|
||||
return job_config.SerializeToString()
|
||||
Reference in New Issue
Block a user