odps/mars_extension/legacy/deploy/app.py [225:302]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    def __init__(self, *args, **kwargs):
        self._with_notebook = kwargs.pop("with_notebook", False)
        self._notebook_cpu = kwargs.pop("notebook_cpu", None)
        self._notebook_mem = kwargs.pop("notebook_mem", None)

        self._notebook_extra_env = kwargs.get("extra_env", None) or dict()
        self._notebook_extra_env.update(
            kwargs.pop("notebook_extra_env", None) or dict()
        )

        self._with_graphscope = kwargs.pop("with_graphscope", False)
        self._coordinator_extra_env = kwargs.get("extra_env", None) or dict()
        self._coordinator_extra_env.update(
            kwargs.pop("coordinator_extra_env", None) or dict()
        )
        self._coordinator_cpu = kwargs.pop("coordinator_cpu", None)
        self._coordinator_mem = kwargs.pop("coordinator_mem", None)

        self._node_blacklist = set(kwargs.pop("node_blacklist", None) or [])
        self._blacklisted_pods = set()

        kwargs["image"] = build_mars_image_name(kwargs.pop("image", None))
        super().__init__(*args, **kwargs)

    def _create_notebook(self):
        if self._with_notebook:
            notebook_config = CupidMarsNotebooksConfig(
                1,
                image=self._image,
                cpu=self._notebook_cpu,
                memory=self._notebook_mem,
                volumes=self._extra_volumes,
                pre_stop_command=self._pre_stop_command,
            )
            notebook_config.add_simple_envs(self._notebook_extra_env)
            self._core_api.create_namespaced_replication_controller(
                self._namespace, notebook_config.build()
            )

    def _create_graphscope(self):
        if self._with_graphscope:
            # check the worker services are ready
            limits = [self._worker_num]
            selectors = ["mars/service-type=" + CupidMarsWorkersConfig.rc_name]
            wait_services_ready(
                selectors,
                limits,
                lambda sel: self._get_ready_pod_count(sel),
                timeout=self._timeout,
            )
            # get the worker pod name and ip
            worker_pod_name_list, worker_pod_ip_list = self._get_pods_name_and_ip(
                selectors[0]
            )
            coordinator_config = CupidGSCoordinatorConfig(
                1,
                image=self._image,
                cpu=self._coordinator_cpu,
                memory=self._coordinator_mem,
                volumes=self._extra_volumes,
                pre_stop_command=self._pre_stop_command,
                worker_pod_name_list=worker_pod_name_list,
                worker_pod_ip_list=worker_pod_ip_list,
                worker_num=self._worker_num,
            )
            coordinator_config.add_simple_envs(self._coordinator_extra_env)
            self._core_api.create_namespaced_replication_controller(
                self._namespace, coordinator_config.build()
            )

    def _create_services(self):
        super()._create_services()
        self._create_graphscope()
        self._create_notebook()

    def _create_kube_service(self):
        # does not create k8s service as not supported in cupid
        pass
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



odps/mars_extension/oscar/deploy/app.py [216:293]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    def __init__(self, *args, **kwargs):
        self._with_notebook = kwargs.pop("with_notebook", False)
        self._notebook_cpu = kwargs.pop("notebook_cpu", None)
        self._notebook_mem = kwargs.pop("notebook_mem", None)

        self._notebook_extra_env = kwargs.get("extra_env", None) or dict()
        self._notebook_extra_env.update(
            kwargs.pop("notebook_extra_env", None) or dict()
        )

        self._with_graphscope = kwargs.pop("with_graphscope", False)
        self._coordinator_extra_env = kwargs.get("extra_env", None) or dict()
        self._coordinator_extra_env.update(
            kwargs.pop("coordinator_extra_env", None) or dict()
        )
        self._coordinator_cpu = kwargs.pop("coordinator_cpu", None)
        self._coordinator_mem = kwargs.pop("coordinator_mem", None)

        self._node_blacklist = set(kwargs.pop("node_blacklist", None) or [])
        self._blacklisted_pods = set()

        kwargs["image"] = build_mars_image_name(kwargs.pop("image", None))
        super().__init__(*args, **kwargs)

    def _create_notebook(self):
        if self._with_notebook:
            notebook_config = CupidMarsNotebooksConfig(
                1,
                image=self._image,
                cpu=self._notebook_cpu,
                memory=self._notebook_mem,
                volumes=self._extra_volumes,
                pre_stop_command=self._pre_stop_command,
            )
            notebook_config.add_simple_envs(self._notebook_extra_env)
            self._core_api.create_namespaced_replication_controller(
                self._namespace, notebook_config.build()
            )

    def _create_graphscope(self):
        if self._with_graphscope:
            # check the worker services are ready
            limits = [self._worker_num]
            selectors = ["mars/service-type=" + CupidMarsWorkersConfig.rc_name]
            wait_services_ready(
                selectors,
                limits,
                lambda sel: self._get_ready_pod_count(sel),
                timeout=self._timeout,
            )
            # get the worker pod name and ip
            worker_pod_name_list, worker_pod_ip_list = self._get_pods_name_and_ip(
                selectors[0]
            )
            coordinator_config = CupidGSCoordinatorConfig(
                1,
                image=self._image,
                cpu=self._coordinator_cpu,
                memory=self._coordinator_mem,
                volumes=self._extra_volumes,
                pre_stop_command=self._pre_stop_command,
                worker_pod_name_list=worker_pod_name_list,
                worker_pod_ip_list=worker_pod_ip_list,
                worker_num=self._worker_num,
            )
            coordinator_config.add_simple_envs(self._coordinator_extra_env)
            self._core_api.create_namespaced_replication_controller(
                self._namespace, coordinator_config.build()
            )

    def _create_services(self):
        super()._create_services()
        self._create_graphscope()
        self._create_notebook()

    def _create_kube_service(self):
        # does not create k8s service as not supported in cupid
        pass
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



