Skip to content

Commit

Permalink
Add more deprecation warnings ahead of removing old code (#811)
Browse files Browse the repository at this point in the history
* Add more deprecation warnings ahead of removing old code

* Remove failing test
  • Loading branch information
jacobtomlinson committed Sep 11, 2023
1 parent bd1bb7e commit 32b296b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 19 deletions.
9 changes: 0 additions & 9 deletions dask_kubernetes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,6 @@

def __getattr__(name):
if name == "KubeCluster":
warn(
"It looks like you are using the classic implementation of KubeCluster. "
"Please consider migrating to the new operator based implementation "
"https://kubernetes.dask.org/en/latest/kubecluster_migrating.html. "
"To suppress this warning import KubeCluster directly from dask_kubernetes.classic. "
"But note this will be removed in the future. ",
DeprecationWarning,
stacklevel=2,
)
new_module = import_module("dask_kubernetes.classic")
return getattr(new_module, name)

Expand Down
8 changes: 7 additions & 1 deletion dask_kubernetes/classic/kubecluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,13 @@ def __init__(
apply_default_affinity="preferred",
**kwargs
):
warnings.warn(
"The classic KubeCluster is going away. "
"Please migrate to the new operator based implementation "
"https://kubernetes.dask.org/en/latest/kubecluster_migrating.html. ",
DeprecationWarning,
stacklevel=2,
)
if isinstance(pod_template, str):
with open(pod_template) as f:
pod_template = dask.config.expand_environment_variables(
Expand Down Expand Up @@ -561,7 +568,6 @@ def _fill_pod_templates(self, pod_template, pod_type):
return pod_template

async def _start(self):

self.pod_template = self._get_pod_template(self.pod_template, pod_type="worker")
self.scheduler_pod_template = self._get_pod_template(
self.scheduler_pod_template, pod_type="scheduler"
Expand Down
9 changes: 0 additions & 9 deletions dask_kubernetes/classic/tests/test_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,6 @@
FAKE_CA = os.path.join(TEST_DIR, "fake-ca-file")


def test_deprecation_warning():
with pytest.deprecated_call():
from dask_kubernetes import KubeCluster as TLKubeCluster

from dask_kubernetes.classic import KubeCluster as ClassicKubeCluster

assert TLKubeCluster is ClassicKubeCluster


@pytest.fixture
def pod_spec(docker_image):
yield clean_pod_template(
Expand Down
7 changes: 7 additions & 0 deletions dask_kubernetes/helm/helmcluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ def __init__(
name=None,
**kwargs,
):
warnings.warn(
"HelmCluster is going away. "
"Please migrate to the new operator based implementation "
"https://kubernetes.dask.org/en/latest/kubecluster_migrating.html. ",
DeprecationWarning,
stacklevel=2,
)
self.release_name = release_name
self.namespace = namespace or get_current_namespace()
if name is None:
Expand Down

0 comments on commit 32b296b

Please sign in to comment.