Exemple #1
0
def test_tracing_rest(namespace):
    # Deploy model and check that is running
    retry_run(
        f"kubectl apply -f ../resources/graph-tracing.json -n {namespace}")
    wait_for_status("mymodel", namespace)
    wait_for_rollout("mymodel", namespace)
    initial_rest_request("mymodel", namespace)

    # We need the current pod name to find the right traces
    deployment_names = get_deployment_names("mymodel", namespace)
    deployment_name = deployment_names[0]
    pod_names = get_pod_names(deployment_name, namespace)
    pod_name = pod_names[0]

    print("deployment name", deployment_name, "pod name", pod_name)

    # The engine and the executor identify as different services and different
    # operations against Jaeger. We need to consider both.
    service = "executor"
    operation = "predictions"
    request_operation = "/predict"

    # Get traces and assert their content
    traces = get_traces(pod_name,
                        service,
                        operation,
                        _should_retry=_is_jaeger_syncing)
    assert len(traces) == 1

    trace = traces[0]
    processes = trace["processes"]
    assert len(processes) == 2
    assert_trace(trace,
                 expected_operations=[operation, request_operation, "Predict"])
Exemple #2
0
def test_tracing_rest(namespace):
    # Deploy model and check that is running
    retry_run(
        f"kubectl apply -f ../resources/graph-tracing.json -n {namespace}")
    wait_for_status("mymodel", namespace)
    wait_for_rollout("mymodel", namespace)
    initial_rest_request("mymodel", namespace)

    # We need the current pod name to find the right traces
    deployment_names = get_deployment_names("mymodel", namespace)
    deployment_name = deployment_names[0]
    pod_names = get_pod_names(deployment_name, namespace)
    pod_name = pod_names[0]

    # Get traces and assert their content
    traces = get_traces(pod_name,
                        "executor",
                        "predictions",
                        _should_retry=_is_jaeger_syncing)
    assert len(traces) == 1

    trace = traces[0]
    processes = trace["processes"]
    assert len(processes) == 2
    assert_trace(trace,
                 expected_operations=["predictions", "/predict", "Predict"])
Exemple #3
0
def test_rolling_update_deployment(
    namespace, api_gateway, from_deployment, to_deployment
):
    if api_gateway == API_ISTIO_GATEWAY:
        retry_run(f"kubectl create -f ../resources/seldon-gateway.yaml -n {namespace}")

    from_file_path = to_resources_path(from_deployment)
    retry_run(f"kubectl apply -f {from_file_path} -n {namespace}")
    wait_for_status("mymodel", namespace)
    wait_for_rollout("mymodel", namespace)
    assert_model("mymodel", namespace, initial=True, endpoint=api_gateway)

    old_deployment_name = get_deployment_names("mymodel", namespace)[0]
    to_file_path = to_resources_path(to_deployment)

    def _update_model():
        retry_run(f"kubectl apply -f {to_file_path} -n {namespace}")
        wait_for_shutdown(old_deployment_name, namespace)
        wait_for_status("mymodel", namespace)
        wait_for_rollout("mymodel", namespace)

    assert_model_during_op(_update_model, "mymodel", namespace, endpoint=api_gateway)

    delete_cmd = f"kubectl delete --ignore-not-found -n {namespace}"
    run(f"{delete_cmd} -f {from_file_path}", shell=True)
    run(f"{delete_cmd} -f {to_file_path}", shell=True)