Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace distutils.spawn (deprecated) with shutil.which #261

Merged
merged 12 commits into from
Feb 2, 2023
4 changes: 2 additions & 2 deletions merlin/systems/triton/utils.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import contextlib
import logging
import os
import shutil
import signal
import socket
import subprocess
import time
from distutils.spawn import find_executable

import tritonclient
import tritonclient.grpc as grpcclient
Expand All @@ -14,7 +14,7 @@

LOG = logging.getLogger("merlin-systems")

TRITON_SERVER_PATH = find_executable("tritonserver")
TRITON_SERVER_PATH = shutil.which("tritonserver")


@contextlib.contextmanager
Expand Down
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import glob
import random
from distutils.spawn import find_executable
import shutil
from pathlib import Path

import dask
Expand Down Expand Up @@ -50,7 +50,7 @@ def assert_eq(a, b, *args, **kwargs):


REPO_ROOT = Path(__file__).parent.parent
TRITON_SERVER_PATH = find_executable("tritonserver")
TRITON_SERVER_PATH = shutil.which("tritonserver")


allcols_csv = ["timestamp", "id", "label", "name-string", "x", "y", "z"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from distutils.spawn import find_executable # pylint: disable=deprecated-module
import shutil

import pytest
from testbook import testbook
Expand All @@ -17,7 +17,7 @@
except ImportError:
_TRAIN_ON_GPU = [False]

TRITON_SERVER_PATH = find_executable("tritonserver")
TRITON_SERVER_PATH = shutil.which("tritonserver")


@pytest.mark.notebook
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from distutils.spawn import find_executable # pylint: disable=deprecated-module
import shutil

import pytest
from testbook import testbook
Expand All @@ -10,7 +10,7 @@
pytest.importorskip("merlin.models")
pytest.importorskip("xgboost")

TRITON_SERVER_PATH = find_executable("tritonserver")
TRITON_SERVER_PATH = shutil.which("tritonserver")


@pytest.mark.skipif(not TRITON_SERVER_PATH, reason="triton server not found")
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/systems/dag/ops/test_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.
#
import random
from distutils.spawn import find_executable
import shutil

import numpy as np
import pytest
Expand All @@ -26,7 +26,7 @@
from merlin.systems.dag.ops.softmax_sampling import SoftmaxSampling
from merlin.systems.triton.utils import run_ensemble_on_tritonserver

TRITON_SERVER_PATH = find_executable("tritonserver")
TRITON_SERVER_PATH = shutil.which("tritonserver")


@pytest.mark.skipif(not TRITON_SERVER_PATH, reason="triton server not found")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from distutils.spawn import find_executable # pylint: disable=W0402
import shutil

import numpy as np
import pandas as pd
Expand All @@ -16,7 +16,7 @@
triton = pytest.importorskip("merlin.systems.triton")
export = pytest.importorskip("merlin.systems.dag.ensemble")

TRITON_SERVER_PATH = find_executable("tritonserver")
TRITON_SERVER_PATH = shutil.which("tritonserver")


@pytest.mark.skipif(not TRITON_SERVER_PATH, reason="triton server not found")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from distutils.spawn import find_executable # pylint: disable=W0402
import shutil

import numpy as np
import pandas as pd
Expand All @@ -16,7 +16,7 @@
triton = pytest.importorskip("merlin.systems.triton")
export = pytest.importorskip("merlin.systems.dag.ensemble")

TRITON_SERVER_PATH = find_executable("tritonserver")
TRITON_SERVER_PATH = shutil.which("tritonserver")


@pytest.mark.skipif(not TRITON_SERVER_PATH, reason="triton server not found")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from distutils.spawn import find_executable # pylint: disable=W0402
import shutil

import numpy as np
import pandas as pd
Expand All @@ -16,7 +16,7 @@
triton = pytest.importorskip("merlin.systems.triton")
export = pytest.importorskip("merlin.systems.dag.ensemble")

TRITON_SERVER_PATH = find_executable("tritonserver")
TRITON_SERVER_PATH = shutil.which("tritonserver")


@pytest.mark.skipif(not TRITON_SERVER_PATH, reason="triton server not found")
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/systems/dag/runtimes/triton/ops/torch/test_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#

import pathlib
from distutils.spawn import find_executable # pylint: disable=deprecated-module
import shutil
from pathlib import Path
from typing import Dict

Expand All @@ -30,7 +30,7 @@
from merlin.systems.dag.runtimes.triton import TritonExecutorRuntime
from merlin.systems.triton.utils import run_triton_server

TRITON_SERVER_PATH = find_executable("tritonserver")
TRITON_SERVER_PATH = shutil.which("tritonserver")

torch = pytest.importorskip("torch")
triton = pytest.importorskip("merlin.systems.triton")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
from distutils.spawn import find_executable # pylint: disable=deprecated-module
import shutil

import numpy as np
import pytest
Expand All @@ -24,7 +24,7 @@
from nvtabular import Workflow
from nvtabular import ops as wf_ops

TRITON_SERVER_PATH = find_executable("tritonserver")
TRITON_SERVER_PATH = shutil.which("tritonserver")

triton = pytest.importorskip("merlin.systems.triton")
ensemble = pytest.importorskip("merlin.systems.dag.ensemble")
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/systems/dag/runtimes/triton/test_triton.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#

import random
from distutils.spawn import find_executable # pylint: disable=W0402
import shutil

import numpy as np
import pytest
Expand All @@ -30,7 +30,7 @@
triton = pytest.importorskip("merlin.systems.triton")
export = pytest.importorskip("merlin.systems.dag.ensemble")

TRITON_SERVER_PATH = find_executable("tritonserver")
TRITON_SERVER_PATH = shutil.which("tritonserver")


@pytest.mark.skipif(not TRITON_SERVER_PATH, reason="triton server not found")
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/systems/dag/test_executors.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.
#
import random
from distutils.spawn import find_executable
import shutil

import numpy as np
import pandas as pd
Expand All @@ -28,7 +28,7 @@
from merlin.systems.dag.ensemble import Ensemble
from merlin.systems.dag.ops.session_filter import FilterCandidates

TRITON_SERVER_PATH = find_executable("tritonserver")
TRITON_SERVER_PATH = shutil.which("tritonserver")


def test_run_dag_on_dictarray_with_local_executor():
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/systems/ops/faiss/test_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
from distutils.spawn import find_executable # pylint: disable=W0402
import shutil

import numpy as np
import pytest
Expand All @@ -23,7 +23,7 @@
from merlin.systems.dag.ensemble import Ensemble
from merlin.systems.dag.ops.faiss import QueryFaiss, setup_faiss

TRITON_SERVER_PATH = find_executable("tritonserver")
TRITON_SERVER_PATH = shutil.which("tritonserver")
pytest.importorskip("merlin.dataloader.tf_utils")
from merlin.dataloader.tf_utils import configure_tensorflow # noqa

Expand Down
4 changes: 2 additions & 2 deletions tests/unit/systems/ops/fil/test_ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.
#
import os
from distutils.spawn import find_executable
import shutil

import numpy as np
import pandas as pd
Expand All @@ -38,7 +38,7 @@
from merlin.systems.dag.ops.workflow import TransformWorkflow # noqa
from merlin.systems.triton.utils import run_ensemble_on_tritonserver # noqa

TRITON_SERVER_PATH = find_executable("tritonserver")
TRITON_SERVER_PATH = shutil.which("tritonserver")


@pytest.mark.skipif(not TRITON_SERVER_PATH, reason="triton server not found")
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/systems/ops/implicit/test_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
from distutils.spawn import find_executable
import shutil

import implicit
import numpy as np
Expand All @@ -25,7 +25,7 @@
from merlin.systems.dag.ensemble import Ensemble
from merlin.systems.dag.ops.implicit import PredictImplicit

TRITON_SERVER_PATH = find_executable("tritonserver")
TRITON_SERVER_PATH = shutil.which("tritonserver")

tritonclient = pytest.importorskip("tritonclient")
grpcclient = pytest.importorskip("tritonclient.grpc")
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/systems/ops/implicit/test_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.
#
import json
from distutils.spawn import find_executable
import shutil

import implicit
import numpy as np
Expand All @@ -28,7 +28,7 @@
from merlin.systems.dag.runtimes.triton import TritonExecutorRuntime
from merlin.systems.triton.utils import run_triton_server

TRITON_SERVER_PATH = find_executable("tritonserver")
TRITON_SERVER_PATH = shutil.which("tritonserver")

triton = pytest.importorskip("merlin.systems.triton")

Expand Down
4 changes: 2 additions & 2 deletions tests/unit/systems/ops/tf/test_ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.
#
import os
from distutils.spawn import find_executable
import shutil

import pytest

Expand Down Expand Up @@ -45,7 +45,7 @@
from merlin.systems.triton.utils import run_ensemble_on_tritonserver # noqa
from tests.unit.systems.utils.tf import create_tf_model # noqa

TRITON_SERVER_PATH = find_executable("tritonserver")
TRITON_SERVER_PATH = shutil.which("tritonserver")


@pytest.mark.skipif(not TRITON_SERVER_PATH, reason="triton server not found")
Expand Down