def test_undeploy_docker(sklearn_model: Model, docker_runtime: SeldonDockerRuntime): sklearn_model.deploy() time.sleep(2) sklearn_model.undeploy() with pytest.raises(docker.errors.NotFound): docker_runtime._get_container(sklearn_model.details)
def test_deploy_docker(sklearn_model: Model, docker_runtime: SeldonDockerRuntime): sklearn_model.deploy() time.sleep(2) container = docker_runtime._get_container(sklearn_model.details) assert container.status == "running" sklearn_model.undeploy()
def test_sklearn_docker(sklearn_model: Model, x_input): sklearn_model.deploy() time.sleep(2) y_pred = sklearn_model(x_input) np.testing.assert_allclose(y_pred, [[0, 0, 0.99]], atol=1e-2) sklearn_model.undeploy()
def k8s_sklearn_model(sklearn_model: Model, k8s_runtime: SeldonKubernetesRuntime) -> Generator[Model, None, None]: sklearn_model.runtime = k8s_runtime sklearn_model.deploy() sklearn_model.wait_ready(timeout_secs=60) yield sklearn_model sklearn_model.undeploy()
def k8s_sklearn_model( sklearn_model: Model, k8s_runtime: SeldonKubernetesRuntime) -> Generator[Model, None, None]: sklearn_model._runtime = k8s_runtime sklearn_model.deploy() time.sleep(40) yield sklearn_model sklearn_model.undeploy()
def test_deploy(): rt = SeldonDeployRuntime( host="http://34.105.136.157/seldon-deploy/api/v1alpha1", user="******", password="******", k8s_options=KubernetesOptions(namespace="seldon"), ) sklearn_model = Model( name="test-iris-sklearn", runtime=rt, platform=ModelFramework.SKLearn, uri="gs://seldon-models/sklearn/iris", local_folder=os.getcwd() + "/sklearn", ) sklearn_model.deploy() sklearn_model.wait_ready() sklearn_model(np.array([[4.9, 3.1, 1.5, 0.2]]))