Exemple #1
0
def test_seldon_xgboost_model_yaml(expected):
    m = Model(
        name="test-iris-xgboost",
        protocol=SeldonProtocol(),
        platform=ModelFramework.XGBoost,
        uri="gs://seldon-models/xgboost/iris",
        local_folder="/tmp/model",
    )
    runtime = SeldonKubernetesRuntime()
    print(runtime.to_k8s_yaml(m))
    assert runtime.to_k8s_yaml(m) == expected
Exemple #2
0
def test_deploy_yaml():
    rt = SeldonDeployRuntime(
        host="http://34.78.44.92/seldon-deploy/api/v1alpha1",
        user="******",
        oidc_server="https://34.78.44.92/auth/realms/deploy-realm",
        password="******",
        oidc_client_id="sd-api",
        verify_ssl=False,
    )

    options = RuntimeOptions(
        runtime="tempo.seldon.SeldonKubernetesRuntime",
        k8s_options=KubernetesOptions(namespace="seldon"),
        ingress_options=IngressOptions(ssl=True, verify_ssl=False),
    )

    sklearn_model = Model(
        name="test-iris-sklearn",
        platform=ModelFramework.SKLearn,
        uri="gs://seldon-models/sklearn/iris",
        protocol=SeldonProtocol(),
        runtime_options=options,
    )

    spec = rt.to_k8s_yaml(sklearn_model)
    rtk = SeldonKubernetesRuntime()
    expected = rtk.to_k8s_yaml(sklearn_model)
    assert spec == expected
Exemple #3
0
def test_seldon_sklearn_model_yaml(expected):
    m = Model(
        name="test-iris-sklearn",
        platform=ModelFramework.SKLearn,
        uri="gs://seldon-models/sklearn/iris",
        local_folder="/tmp/model",
        protocol=SeldonProtocol(),
    )
    runtime = SeldonKubernetesRuntime()
    assert runtime.to_k8s_yaml(m) == expected
Exemple #4
0
def test_seldon_model_yaml_auth():
    m = Model(
        name="test-iris-xgboost",
        protocol=SeldonProtocol(),
        platform=ModelFramework.XGBoost,
        uri="gs://seldon-models/xgboost/iris",
        local_folder="/tmp/model",
    )
    runtime = SeldonKubernetesRuntime(
        runtime_options=RuntimeOptions(k8s_options=KubernetesOptions(authSecretName="auth"))
    )
    print(runtime.to_k8s_yaml(m))
Exemple #5
0
 def to_k8s_yaml(self, model_details: ModelDetails) -> str:
     srt = SeldonKubernetesRuntime(k8s_options=self._k8s_options,
                                   protocol=self.protocol)
     return srt.to_k8s_yaml(model_details)