Skip to content

Commit

Permalink
* Add a new option for KubernetesLauncher to deploy the engines in th…
Browse files Browse the repository at this point in the history
…e eager mode or lazy mode.

* Split the create_engine_instances into two steps.
- Allocate the engine instances.
- Distribute the relevant process to the engine instances.

Signed-off-by: Ye Cao <caoye.cao@alibaba-inc.com>
  • Loading branch information
dashanji committed May 24, 2023
1 parent ce22a0e commit 5c86233
Show file tree
Hide file tree
Showing 6 changed files with 234 additions and 156 deletions.
26 changes: 15 additions & 11 deletions coordinator/gscoordinator/cluster_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def __init__(
engine_cpu,
engine_mem,
engine_pod_node_selector,
engine_prefix,
engine_pod_prefix,
glog_level,
image_pull_policy,
image_pull_secrets,
Expand All @@ -75,14 +75,13 @@ def __init__(
volumes,
with_analytical,
with_analytical_java,
with_vineyard,
with_dataset,
with_interactive,
with_learning,
with_mars,
dataset_proxy,
):
self._gs_prefix = engine_prefix
self._gs_prefix = engine_pod_prefix
self._analytical_prefix = "gs-analytical-"
self._interactive_frontend_prefix = "gs-interactive-frontend-"

Expand Down Expand Up @@ -134,7 +133,6 @@ def __init__(
self._with_analytical_java = with_analytical_java
self._with_interactive = with_interactive
self._with_learning = with_learning
self._with_vineyard = with_vineyard
self._with_mars = with_mars

if with_analytical and with_analytical_java:
Expand Down Expand Up @@ -219,17 +217,23 @@ def get_base_machine_env(self):
]
return env

def get_vineyard_socket_volume_from_vineyard_deployment(self, name):
# Notice, the path must be same as the one in vineyardd_types.go
# https://github.com/v6d-io/v6d/blob/main/k8s/apis/k8s/v1alpha1/vineyardd_types.go#L125
path = f"/var/run/vineyard-kubernetes/{self._namespace}/{self._vineyard_deployment}"
host_path = kube_client.V1HostPathVolumeSource(path=path)
host_path.type = "Directory"
volume = kube_client.V1Volume(name=name, host_path=host_path)
return volume

def get_vineyard_socket_volume(self):
name = "vineyard-ipc-socket"
volume = kube_client.V1Volume(name=name)
if self._vineyard_deployment is None:
if self.vineyard_deployment_exists():
volume = self.get_vineyard_socket_volume_from_vineyard_deployment(name)
else:
empty_dir = kube_client.V1EmptyDirVolumeSource()
volume.empty_dir = empty_dir
else:
path = f"/var/run/vineyard-kubernetes/{self._namespace}/{self._vineyard_deployment}"
host_path = kube_client.V1HostPathVolumeSource(path=path)
host_path.type = "Directory"
volume.host_path = host_path

source_volume_mount = kube_client.V1VolumeMount(
name=name, mount_path="/tmp/vineyard_workspace"
Expand Down Expand Up @@ -405,7 +409,7 @@ def get_engine_pod_spec(self):

engine_volume_mounts = [socket_volume[2], shm_volume[2]]

if self._volumes and self._volumes is not None:
if self._volumes is not None:
udf_volumes = ResourceBuilder.get_user_defined_volumes(self._volumes)
volumes.extend(udf_volumes[0])
engine_volume_mounts.extend(udf_volumes[2])
Expand Down
7 changes: 7 additions & 0 deletions coordinator/gscoordinator/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,12 @@ def parse_sys_args():
default=False,
help="Mount the aliyun dataset bucket as a volume by ossfs.",
)
parser.add_argument(
"--mode",
type=str,
default="eager",
help="The deploying mode of graphscope, eager or lazy.",
)
parser.add_argument(
"--monitor",
type=str2bool,
Expand Down Expand Up @@ -933,6 +939,7 @@ def get_launcher(args):
with_mars=args.k8s_with_mars,
enabled_engines=args.k8s_enabled_engines,
dataset_proxy=args.dataset_proxy,
mode=args.mode,
)
elif args.cluster_type == "hosts":
launcher = LocalLauncher(
Expand Down
Loading

0 comments on commit 5c86233

Please sign in to comment.