# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# # Example Go Wrapper for Seldon Core
#
# This notebook goes through the steps to test the Go wrapper. This is presently an example of how to wrap code to run in Go in Seldon. 
#
#

# Below shows example code for a REST and gRPC server in Go that handles the Seldon Core microservice API for MODELs.

# !pygmentize server.go

# ## Local Docker Test
#
# For this test we will use the code as is which returns a hard-wired result. For real use you should copy this Go project to build your own components.
#

# !make build_docker

# Run a REST test

# !make test_docker_rest

# !seldon-core-tester contract.json 0.0.0.0 10000 -p

# !docker rm -f gomodel

# Run a gRPC test

# !make test_docker_grpc

# !seldon-core-tester contract.json 0.0.0.0 10000 -p --grpc --tensor

# !docker rm -f gomodel

# ## Test in Minikube

# !minikube start --memory 4096

# !kubectl create clusterrolebinding kube-system-cluster-admin --clusterrole=cluster-admin --serviceaccount=kube-system:default

# !helm init

# !kubectl rollout status deploy/tiller-deploy -n kube-system

# !helm install ../../../helm-charts/seldon-core-operator --name seldon-core --set usageMetrics.enabled=true --namespace seldon-system

# !kubectl rollout status statefulset.apps/seldon-operator-controller-manager -n seldon-system

# ## Setup Ingress
# Please note: There are reported gRPC issues with ambassador (see https://github.com/SeldonIO/seldon-core/issues/473).

# !helm install stable/ambassador --name ambassador --set crds.keep=false

# !kubectl rollout status deployment.apps/ambassador

# !eval $(minikube docker-env) && make build_docker

# !kubectl create -f resources/deployment_example.json

# !kubectl rollout status deploy/go-deployment-go-predictor-27dfae4

# !seldon-core-api-tester contract.json `minikube ip` `kubectl get svc ambassador -o jsonpath='{.spec.ports[0].nodePort}'` \
#     example-go --namespace default -p

# !minikube delete

StarcoderdataJupyterScriptsDedupFiltered