Skip to content

Commit

Permalink
add engine resources to proto and modify cluster manager
Browse files Browse the repository at this point in the history
  • Loading branch information
ukclivecox committed Jan 24, 2018
1 parent 9aeccaf commit 1eac525
Show file tree
Hide file tree
Showing 4 changed files with 131 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ private static String getEngineEnvVarJson(Message protoMessage) throws SeldonDep
private V1.Container createEngineContainer(SeldonDeployment dep,PredictorSpec predictorDef) throws SeldonDeploymentException
{
V1.Container.Builder cBuilder = V1.Container.newBuilder();

cBuilder
.setName("seldon-container-engine")
.setImage(clusterManagerProperites.getEngineContainerImageAndVersion())
.setResources(V1.ResourceRequirements.newBuilder().putRequests("cpu", Quantity.newBuilder().setString("0.1").build()))
.addEnv(EnvVar.newBuilder().setName("ENGINE_PREDICTOR").setValue(getEngineEnvVarJson(predictorDef)))
.addEnv(EnvVar.newBuilder().setName("ENGINE_SELDON_DEPLOYMENT").setValue(getEngineEnvVarJson(dep)))
.addEnv(EnvVar.newBuilder().setName("ENGINE_SERVER_PORT").setValue(""+clusterManagerProperites.getEngineContainerPort()))
Expand Down Expand Up @@ -125,7 +125,11 @@ private V1.Container createEngineContainer(SeldonDeployment dep,PredictorSpec pr
.addCommand("-c")
.addCommand("curl 127.0.0.1:"+clusterManagerProperites.getEngineContainerPort()+"/pause && /bin/sleep 5"))));


// Add engine resources if specified
if (predictorDef.hasEngineResources())
cBuilder.setResources(predictorDef.getEngineResources());
else // set default resource requests for cpu
cBuilder.setResources(V1.ResourceRequirements.newBuilder().putRequests("cpu", Quantity.newBuilder().setString("0.1").build()));

return cBuilder.build();
}
Expand Down
121 changes: 64 additions & 57 deletions notebooks/kubectl_demo_minikube.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
"output_type": "stream",
"text": [
"$HELM_HOME has been configured at /home/clive/.helm.\n",
"\n",
"Tiller (the Helm server-side component) has been installed into your Kubernetes Cluster.\n",
"Warning: Tiller is already installed in the cluster.\n",
"(Use --client-only to suppress this message, or --upgrade to upgrade Tiller to the current version.)\n",
"Happy Helming!\n"
]
}
Expand Down Expand Up @@ -188,7 +188,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 7,
"metadata": {
"collapsed": false
},
Expand All @@ -198,74 +198,73 @@
"output_type": "stream",
"text": [
"NAME: seldon-core\n",
"LAST DEPLOYED: Tue Jan 9 16:38:47 2018\n",
"LAST DEPLOYED: Wed Jan 24 16:31:43 2018\n",
"NAMESPACE: default\n",
"STATUS: DEPLOYED\n",
"\n",
"RESOURCES:\n",
"==> v1/Secret\n",
"NAME TYPE DATA AGE\n",
"grafana-prom-secret Opaque 1 4s\n",
"\n",
"==> v1/ConfigMap\n",
"NAME DATA AGE\n",
"alertmanager-server-conf 1 4s\n",
"grafana-import-dashboards 5 4s\n",
"prometheus-rules 4 4s\n",
"prometheus-server-conf 1 4s\n",
"\n",
"==> v1beta1/CustomResourceDefinition\n",
"NAME AGE\n",
"seldondeployments.machinelearning.seldon.io 4s\n",
"\n",
"==> v1/Pod\n",
"NAME READY STATUS RESTARTS AGE\n",
"zookeeper-1 0/1 Pending 0 2s\n",
"zookeeper-2 0/1 Pending 0 2s\n",
"zookeeper-3 0/1 Pending 0 2s\n",
"\n",
"==> v1/Job\n",
"NAME DESIRED SUCCESSFUL AGE\n",
"grafana-prom-import-dashboards 1 0 4s\n",
"grafana-prom-import-dashboards 1 0 2s\n",
"\n",
"==> v1beta1/Deployment\n",
"NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE\n",
"alertmanager-deployment 1 1 1 0 3s\n",
"seldon-apiserver 1 1 1 0 3s\n",
"seldon-cluster-manager 1 1 1 0 3s\n",
"grafana-prom-deployment 1 1 1 0 3s\n",
"kafka 1 1 1 0 3s\n",
"prometheus-deployment 1 1 1 0 3s\n",
"redis 1 1 1 0 3s\n",
"alertmanager-deployment 1 1 1 0 2s\n",
"seldon-apiserver 1 1 1 0 2s\n",
"seldon-cluster-manager 1 1 1 0 2s\n",
"grafana-prom-deployment 1 1 1 0 2s\n",
"kafka 1 1 1 0 2s\n",
"prometheus-deployment 1 1 1 0 2s\n",
"redis 1 1 1 0 2s\n",
"\n",
"==> v1/Service\n",
"NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE\n",
"alertmanager ClusterIP 10.103.61.75 <none> 80/TCP 3s\n",
"seldon-apiserver NodePort 10.99.214.150 <none> 8080:30032/TCP,5000:30033/TCP 3s\n",
"grafana-prom NodePort 10.104.27.246 <none> 80:30034/TCP 3s\n",
"kafka NodePort 10.98.31.127 <none> 9092:30010/TCP 3s\n",
"prometheus-node-exporter ClusterIP None <none> 9100/TCP 3s\n",
"prometheus-seldon ClusterIP 10.108.244.208 <none> 80/TCP 3s\n",
"redis ClusterIP 10.104.201.88 <none> 6379/TCP 3s\n",
"zookeeper-1 ClusterIP 10.102.144.71 <none> 2181/TCP,2888/TCP,3888/TCP 3s\n",
"zookeeper-2 ClusterIP 10.110.17.14 <none> 2181/TCP,2888/TCP,3888/TCP 3s\n",
"zookeeper-3 ClusterIP 10.109.110.125 <none> 2181/TCP,2888/TCP,3888/TCP 2s\n",
"alertmanager ClusterIP 10.109.60.246 <none> 80/TCP 2s\n",
"seldon-apiserver NodePort 10.108.75.248 <none> 8080:30032/TCP,5000:30033/TCP 2s\n",
"grafana-prom NodePort 10.106.21.7 <none> 80:30034/TCP 2s\n",
"kafka NodePort 10.103.159.220 <none> 9092:30010/TCP 2s\n",
"prometheus-node-exporter ClusterIP None <none> 9100/TCP 2s\n",
"prometheus-seldon ClusterIP 10.102.249.205 <none> 80/TCP 2s\n",
"redis ClusterIP 10.103.92.39 <none> 6379/TCP 1s\n",
"zookeeper-1 ClusterIP 10.96.109.253 <none> 2181/TCP,2888/TCP,3888/TCP 1s\n",
"zookeeper-2 ClusterIP 10.100.165.161 <none> 2181/TCP,2888/TCP,3888/TCP 1s\n",
"zookeeper-3 ClusterIP 10.100.226.57 <none> 2181/TCP,2888/TCP,3888/TCP 1s\n",
"\n",
"==> v1/Pod\n",
"NAME READY STATUS RESTARTS AGE\n",
"zookeeper-1 0/1 Pending 0 1s\n",
"zookeeper-2 0/1 Pending 0 1s\n",
"zookeeper-3 0/1 Pending 0 1s\n",
"\n",
"==> v1/Pod(related)\n",
"grafana-prom-import-dashboards-8x74c 0/1 ContainerCreating 0 2s\n",
"alertmanager-deployment-6f5c9c5f58-98jf8 0/1 ContainerCreating 0 2s\n",
"seldon-apiserver-85b66fd56f-pz5vx 0/1 ContainerCreating 0 2s\n",
"seldon-cluster-manager-7cb44ddc7-skbcc 0/1 ContainerCreating 0 2s\n",
"grafana-prom-deployment-bf46c5988-cmwtl 0/1 ContainerCreating 0 2s\n",
"kafka-68cc697c5-g464q 0/1 Pending 0 2s\n",
"prometheus-node-exporter-2qj8m 0/1 Pending 0 2s\n",
"prometheus-deployment-6b7f9fcbc6-bttk9 0/1 Pending 0 2s\n",
"redis-5767447797-j42t7 0/1 Pending 0 1s\n",
"\n",
"==> v1/ConfigMap\n",
"NAME DATA AGE\n",
"alertmanager-server-conf 1 2s\n",
"grafana-import-dashboards 5 2s\n",
"prometheus-rules 4 2s\n",
"prometheus-server-conf 1 2s\n",
"\n",
"==> v1beta1/CustomResourceDefinition\n",
"NAME AGE\n",
"seldondeployments.machinelearning.seldon.io 2s\n",
"\n",
"==> v1beta1/DaemonSet\n",
"NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE\n",
"prometheus-node-exporter 1 1 0 1 0 <none> 3s\n",
"prometheus-node-exporter 1 1 0 1 0 <none> 2s\n",
"\n",
"==> v1/Pod(related)\n",
"NAME READY STATUS RESTARTS AGE\n",
"grafana-prom-import-dashboards-c7gbj 0/1 ContainerCreating 0 3s\n",
"alertmanager-deployment-6f5c9c5f58-hzfvs 0/1 ContainerCreating 0 3s\n",
"seldon-apiserver-775c6f4cdf-8hzps 0/1 ContainerCreating 0 3s\n",
"seldon-cluster-manager-69fcb5f4-2vt2p 0/1 ContainerCreating 0 3s\n",
"grafana-prom-deployment-bf46c5988-89744 0/1 ContainerCreating 0 3s\n",
"kafka-68cc697c5-hhdvs 0/1 Pending 0 3s\n",
"prometheus-node-exporter-ddlkl 0/1 Pending 0 3s\n",
"prometheus-deployment-6b7f9fcbc6-f56n9 0/1 Pending 0 3s\n",
"redis-5767447797-h456r 0/1 Pending 0 3s\n",
"==> v1/Secret\n",
"NAME TYPE DATA AGE\n",
"grafana-prom-secret Opaque 1 2s\n",
"\n",
"\n",
"NOTES:\n",
Expand Down Expand Up @@ -910,11 +909,19 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"release \"seldon-core\" deleted\r\n"
]
}
],
"source": [
"!helm delete seldon-core --purge"
]
Expand Down
60 changes: 60 additions & 0 deletions notebooks/resources/model_with_engine_resources.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"apiVersion": "machinelearning.seldon.io/v1alpha1",
"kind": "SeldonDeployment",
"metadata": {
"labels": {
"app": "seldon"
},
"name": "seldon-deployment-example"
},
"spec": {
"annotations": {
"project_name": "FX Market Prediction",
"deployment_version": "v1"
},
"name": "test-deployment",
"oauth_key": "oauth-key",
"oauth_secret": "oauth-secret",
"predictors": [
{
"componentSpec": {
"spec": {
"containers": [
{
"image": "seldonio/mock_classifier:1.0",
"imagePullPolicy": "IfNotPresent",
"name": "classifier",
"resources": {
"requests": {
"memory": "1Mi"
}
}
}
],
"terminationGracePeriodSeconds": 20
}
},
"graph": {
"children": [],
"name": "classifier",
"endpoint": {
"type" : "REST"
},
"type": "MODEL"
},
"name": "fx-market-predictor",
"replicas": 1,
"annotations": {
"predictor_version" : "v1"
},
"engineResources" : {
"requests": {
"memory": "1Mi",
"cpu" : "0.2"
}
}
}
]
}
}

1 change: 1 addition & 0 deletions proto/seldon_deployment.proto
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ message PredictorSpec {
required k8s.io.api.core.v1.PodTemplateSpec componentSpec = 3; // A description of the set of containers used by the graph. One for each microservice defined in the graph.
optional int32 replicas = 4; // The number of replicas of the predictor to create.
map<string,string> annotations = 5; // Arbitrary annotations.
optional k8s.io.api.core.v1.ResourceRequirements engineResources = 6; // Optional set of resources for the Seldon engine which is added to each Predictor graph to manage the request/response flow
}


Expand Down

0 comments on commit 1eac525

Please sign in to comment.