Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modify ray_cluster master settings to accept and pass on runtime_env #420

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions python/raydp/spark/ray_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ def __init__(self,
executor_cores,
executor_memory,
enable_hive,
configs):
configs,
runtime_env=None):
super().__init__(None)
self._app_name = app_name
self._spark_master = None
Expand All @@ -49,24 +50,31 @@ def __init__(self,
self._enable_hive = enable_hive
self._configs = configs
self._prepare_spark_configs()
self._set_up_master(resources=self._get_master_resources(self._configs), kwargs=None)
self._set_up_master(resources=self._get_master_resources(self._configs),
runtime_env=runtime_env)
self._spark_session: SparkSession = None

def _set_up_master(self, resources: Dict[str, float], kwargs: Dict[Any, Any]):
def _set_up_master(self, resources: Dict[str, float], runtime_env: Dict[Any, Any]):
# TODO: specify the app master resource
spark_master_name = self._app_name + RAYDP_SPARK_MASTER_SUFFIX

if runtime_env is None:
runtime_env = {}

if resources:
num_cpu = 1
if "CPU" in resources:
num_cpu = resources["CPU"]
resources.pop("CPU", None)

self._spark_master_handle = RayDPSparkMaster.options(name=spark_master_name,
num_cpus=num_cpu,
resources=resources) \
resources=resources,
runtime_env=runtime_env) \
.remote(self._configs)
else:
self._spark_master_handle = RayDPSparkMaster.options(name=spark_master_name) \
self._spark_master_handle = RayDPSparkMaster.options(name=spark_master_name,
runtime_env=runtime_env) \
.remote(self._configs)

ray.get(self._spark_master_handle.start_up.remote())
Expand Down
Loading