diff --git a/Makefile b/Makefile index 1c479aaec..b871c1d2c 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ format: black dask_kubernetes setup.py lint: - flake8 dask-kubernetes + flake8 dask_kubernetes black --check dask_kubernetes setup.py test: @@ -87,7 +87,7 @@ kind-bootstrap: # https://github.com/kubernetes-sigs/kind curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-${OS}-${ARCHITECTURE} && \ chmod +x ./kind && \ mv kind ${BIN_PATH} - + kind-start: kind create cluster && \ kind export kubeconfig diff --git a/dask_kubernetes/core.py b/dask_kubernetes/core.py index 37b5f1259..80c045258 100644 --- a/dask_kubernetes/core.py +++ b/dask_kubernetes/core.py @@ -3,12 +3,9 @@ import getpass import logging import os -import socket import string import time -from urllib.parse import urlparse import uuid -import weakref from weakref import finalize try: @@ -20,7 +17,6 @@ import dask.distributed import distributed.security from distributed.deploy import SpecCluster, ProcessInterface -from distributed.comm.utils import offload from distributed.utils import Log, Logs import kubernetes_asyncio as kubernetes from kubernetes_asyncio.client.rest import ApiException diff --git a/dask_kubernetes/objects.py b/dask_kubernetes/objects.py index aaef1b309..7762868cd 100644 --- a/dask_kubernetes/objects.py +++ b/dask_kubernetes/objects.py @@ -236,7 +236,7 @@ def clean_pod_template(pod_template, match_node_purpose="prefer", pod_type="work pod_template.spec.tolerations.extend(tolerations) # add default node affinity to k8s.dask.org/node-purpose=worker - if match_node_purpose is not "ignore": + if match_node_purpose != "ignore": # for readability affinity = pod_template.spec.affinity diff --git a/dask_kubernetes/tests/conftest.py b/dask_kubernetes/tests/conftest.py index 184b48c4b..886873f7b 100644 --- a/dask_kubernetes/tests/conftest.py +++ b/dask_kubernetes/tests/conftest.py @@ -1,10 +1,6 @@ -import asyncio - import pytest -import kubernetes - -from dask_kubernetes.auth import ClusterAuth, KubeConfig, InCluster +from dask_kubernetes.auth import KubeConfig, InCluster def pytest_addoption(parser): diff --git a/dask_kubernetes/tests/test_async.py b/dask_kubernetes/tests/test_async.py index 47f2e5af1..42e11a9f8 100644 --- a/dask_kubernetes/tests/test_async.py +++ b/dask_kubernetes/tests/test_async.py @@ -5,7 +5,6 @@ import os import random from time import time -import uuid import yaml import kubernetes_asyncio as kubernetes @@ -736,6 +735,9 @@ def load(self): assert fails["count"] == 3 +@pytest.mark.xfail( + reason="Updating the default client configuration is broken in kubernetes" +) @pytest.mark.asyncio async def test_auth_kubeconfig_with_filename(): await KubeConfig(config_file=CONFIG_DEMO).load() @@ -748,6 +750,9 @@ async def test_auth_kubeconfig_with_filename(): assert config.ssl_ca_cert == FAKE_CA +@pytest.mark.xfail( + reason="Updating the default client configuration is broken in kubernetes" +) @pytest.mark.asyncio async def test_auth_kubeconfig_with_context(): await KubeConfig(config_file=CONFIG_DEMO, context="exp-scratch").load() diff --git a/dask_kubernetes/tests/test_sync.py b/dask_kubernetes/tests/test_sync.py index cec47c326..2ccd6ee08 100644 --- a/dask_kubernetes/tests/test_sync.py +++ b/dask_kubernetes/tests/test_sync.py @@ -1,9 +1,5 @@ -import asyncio -import base64 -import getpass import os from time import sleep, time -import uuid import yaml import dask @@ -11,15 +7,10 @@ from dask_kubernetes import ( KubeCluster, make_pod_spec, - ClusterAuth, - KubeConfig, - KubeAuth, ) from dask.distributed import Client, wait from distributed.utils_test import loop, captured_logger # noqa: F401 from distributed.utils import tmpfile -import kubernetes -from random import random TEST_DIR = os.path.abspath(os.path.join(__file__, "..")) CONFIG_DEMO = os.path.join(TEST_DIR, "config-demo.yaml")