Skip to content
Merged
Show file tree
Hide file tree
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
11 changes: 5 additions & 6 deletions src/dagster_ray/kuberay/client/raycluster/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,14 @@ def __init__(
kube_context: str | None = None,
api_client: ApiClient | None = None,
) -> None:
super().__init__(group=GROUP, version=VERSION, kind=KIND, plural=PLURAL, api_client=api_client)

# these are only used because of kubectl port-forward CLI command
# TODO: remove kubectl usage and remove these attributes
self.kube_config = kube_config
self.kube_context = kube_context

def load_kubeconfig(self):
load_kubeconfig(context=self.kube_context, config_file=self.kube_config)
# note: this call must happen BEFORE creating the api clients
if api_client is None:
load_kubeconfig(context=self.kube_context, config_file=self.kube_config)

super().__init__(group=GROUP, version=VERSION, kind=KIND, plural=PLURAL, api_client=api_client)

def wait_until_ready(
self,
Expand Down
10 changes: 4 additions & 6 deletions src/dagster_ray/kuberay/client/rayjob/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,14 @@ def __init__(
kube_context: str | None = None,
api_client: ApiClient | None = None,
) -> None:
# this call must happen BEFORE creating K8s apis
load_kubeconfig(config_file=kube_config, context=kube_context)

self.kube_config = kube_config
self.kube_context = kube_context

super().__init__(group=GROUP, version=VERSION, kind=KIND, plural=PLURAL, api_client=api_client)
# this call must happen BEFORE creating K8s apis
if api_client is None:
load_kubeconfig(config_file=kube_config, context=kube_context)

def load_kubeconfig(self):
load_kubeconfig(context=self.kube_context, config_file=self.kube_config)
super().__init__(group=GROUP, version=VERSION, kind=KIND, plural=PLURAL, api_client=api_client)

def get_ray_cluster_name(self, name: str, namespace: str, timeout: float, poll_interval: float = 1.0) -> str:
return self.get_status(name, namespace, timeout=timeout, poll_interval=poll_interval)["rayClusterName"]
Expand Down
1 change: 0 additions & 1 deletion src/dagster_ray/kuberay/resources/raycluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class KubeRayClusterClientResource(dg.ConfigurableResource[RayClusterClient]):

def create_resource(self, context: dg.InitResourceContext) -> RayClusterClient:
client = RayClusterClient(kube_context=self.kube_context, kube_config=self.kube_config)
client.load_kubeconfig()
return client


Expand Down
1 change: 0 additions & 1 deletion src/dagster_ray/kuberay/resources/rayjob.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class KubeRayJobClientResource(dg.ConfigurableResource[RayJobClient]):

def create_resource(self, context: dg.InitResourceContext):
client = RayJobClient(kube_context=self.kube_context, kube_config=self.kube_config)
client.load_kubeconfig()
return client


Expand Down