-
Notifications
You must be signed in to change notification settings - Fork 835
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1016 from cliveseldon/executor
Executor
- Loading branch information
Showing
432 changed files
with
72,732 additions
and
4,104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -194,3 +194,4 @@ testing/scripts/go | |
.tox | ||
|
||
operator/operator.tar | ||
operator/helm/tmp/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
IMAGE_VERSION=1.3 | ||
IMAGE_NAME=seldonio/mab_epsilon_greedy | ||
|
||
build: | ||
s2i build . seldonio/seldon-core-s2i-python3:0.4 $(IMAGE_NAME):$(IMAGE_VERSION) | ||
build_rest: | ||
s2i build . -E environment_rest seldonio/seldon-core-s2i-python3:0.15 $(IMAGE_NAME)_rest:$(IMAGE_VERSION) | ||
|
||
push_to_dockerhub: | ||
docker push $(IMAGE_NAME):$(IMAGE_VERSION) | ||
push_to_dockerhub_rest: | ||
docker push $(IMAGE_NAME)_rest:$(IMAGE_VERSION) | ||
|
||
build_grpc: | ||
s2i build . -E environment_grpc seldonio/seldon-core-s2i-python3:0.15 $(IMAGE_NAME)_grpc:$(IMAGE_VERSION) | ||
|
||
push_to_dockerhub_grpc: | ||
docker push $(IMAGE_NAME)_grpc:$(IMAGE_VERSION) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
MODEL_NAME=EpsilonGreedy | ||
API_TYPE=GRPC | ||
SERVICE_TYPE=ROUTER | ||
PERSISTENCE=0 |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,116 +1,50 @@ | ||
# Centralised Logging with the Elastic Stack | ||
# Payload Logging | ||
|
||
## Introduction | ||
|
||
Here we will set up EFK (elasticsearch, fluentd/fluentbit, kibana) as a stack to gather logs from SeldonDeployments and make them searchable. | ||
|
||
This demo is aimed at minikube. | ||
|
||
Alternatives are available and if you are running in cloud then you can consider a managed service from your cloud provider. | ||
|
||
If you just want to bootstrap a full logging and request tracking setup for minikube, run ./full-setup.sh. That includes the [request logging setup](./request-logging/README.md) | ||
|
||
## Setup | ||
|
||
If helm is not already set up then it needs to be configured: | ||
|
||
``` | ||
kubectl -n kube-system create sa tiller | ||
kubectl create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount=kube-system:tiller | ||
helm init --service-account tiller | ||
``` | ||
|
||
Install elasticsearch with minikube configuration: | ||
|
||
``` | ||
helm install --name elasticsearch elasticsearch --version 7.1.1 --namespace=logs -f elastic-minikube.yaml --repo https://helm.elastic.co | ||
``` | ||
|
||
Then fluentd as a collection agent (chosen in preference to fluentbit - see notes at end): | ||
|
||
``` | ||
helm install fluentd-elasticsearch --name fluentd --namespace=logs -f fluentd-values.yaml --repo https://kiwigrid.github.io | ||
``` | ||
|
||
And kibana UI: | ||
|
||
``` | ||
helm install kibana --version 7.1.1 --name=kibana --namespace=logs --set service.type=NodePort --repo https://helm.elastic.co | ||
``` | ||
|
||
## Generating Logging | ||
|
||
First we need seldon and a seldon deployment. | ||
|
||
Install seldon operator: | ||
|
||
``` | ||
helm install --name seldon-core ../../helm-charts/seldon-core-operator/ --namespace seldon-system | ||
``` | ||
|
||
Check that it now recognises the seldon CRD by running `kubectl get sdep`. | ||
|
||
Now a model: | ||
|
||
``` | ||
helm install --name seldon-single-model ../../helm-charts/seldon-single-model/ --set engine.env.LOG_MESSAGES_EXTERNALLY="false" | ||
``` | ||
|
||
And the loadtester: | ||
Logging of request and response payloads from your Seldon Deployment can be accomplished by adding a logging section to any part of the Seldon deployment graph. An example is shown below: | ||
|
||
``` | ||
kubectl label nodes $(kubectl get nodes -o jsonpath='{.items[0].metadata.name}') role=locust --overwrite | ||
helm install --name seldon-core-loadtesting ../../helm-charts/seldon-core-loadtesting/ --set locust.host=http://seldon-single-model-seldon-single-model:8000 --set oauth.enabled=false --set oauth.key=oauth-key --set oauth.secret=oauth-secret --set locust.hatchRate=1 --set locust.clients=1 --set loadtest.sendFeedback=0 --set locust.minWait=0 --set locust.maxWait=0 --set replicaCount=1 | ||
``` | ||
|
||
## Inspecting Logging and Search for Requests | ||
|
||
To find kibana URL | ||
apiVersion: machinelearning.seldon.io/v1 | ||
kind: SeldonDeployment | ||
metadata: | ||
name: seldon-model | ||
spec: | ||
name: test-deployment | ||
predictors: | ||
- componentSpecs: | ||
- spec: | ||
containers: | ||
- image: seldonio/mock_classifier:1.3 | ||
name: classifier | ||
graph: | ||
children: [] | ||
endpoint: | ||
type: REST | ||
name: classifier | ||
type: MODEL | ||
logger: | ||
url: http://mylogging-endpoint | ||
mode: all | ||
name: example | ||
replicas: 1 | ||
``` | ||
echo $(minikube ip)":"$(kubectl get svc kibana-kibana -n logs -o=jsonpath='{.spec.ports[?(@.port==5601)].nodePort}') | ||
``` | ||
|
||
When Kibana appears for the first time there will be a brief animation while it initializes. | ||
On the Welcome page click Explore on my own. | ||
From the top-left or from the `Visualize and Explore Data` panel select the `Discover` item. | ||
In the form field Index pattern enter logstash-* | ||
It should read "Success!" and Click the `> Next` step button on the right. | ||
In the next form select timestamp from the dropdown labeled `Time Filter` field name. | ||
From the bottom-right of the form select `Create index pattern`. | ||
In a moment a list of fields will appear. | ||
From the top-left or the home screen's `Visualize and Explore Data` panel, select the `Discover` item. | ||
The log list will appear. | ||
Refine the list a bit by selecting `log` near the bottom the left-hand Selected fields list. | ||
When you hover over or click on the word `log`, click the `Add` button to the right of the label. | ||
You can create a filter using the `Add Filter` button under `Search`. The field can be `kubernetes.labels.seldon-app` and the value can be an 'is' match on `seldon-single-model-seldon-single-model`. | ||
|
||
The custom fields in the request bodies may not currently be in the index. If you hover over one in a request you may see `No cached mapping for this field`. | ||
|
||
To add mappings, go to `Management` at the bottom-left and then `Index Patterns`. Hit `Refresh` on the index created earlier. The number of fields should increase and `request.data.names` should be present. | ||
|
||
Now we can go back and add a further filter for `data.names` with the operator `exists`. We can add further filters if we want, such as the presence of a feature name or the presence of a feature value. | ||
|
||
![picture](https://raw.githubusercontent.com/SeldonIO/seldon-core/master/examples/centralised-logging/kibana-custom-search.png) | ||
|
||
## Notes | ||
|
||
The fluentd setup is configured to ensure only labelled pods are logged and seldon pods are automatically labelled. | ||
|
||
Fluentbit can be chosen instead. This could be installed with: | ||
The logging for the top level requets response is provided by: | ||
|
||
``` | ||
helm install stable/fluent-bit --name=fluent-bit --namespace=logs --set backend.type=es --set backend.es.host=elasticsearch-master | ||
logger: | ||
url: http://mylogging-endpoint | ||
mode: all | ||
``` | ||
|
||
In that case pods would be logged. At the time of writing fluentbit only supports [excluding pods by label, not including](https://github.com/fluent/fluent-bit/issues/737). | ||
In this example both request and response payloads as specified by the `mode` attribute are sent as CloudEvents to the url `http://mylogging-endpoint`. | ||
|
||
Seldon can also be used to log full HTTP requests. See [request logging guide](./request-logging/README.md) | ||
The specification is: | ||
|
||
The elasticsearch backend is not available externally by default but can be exposed if needed for debugging with `kubectl patch svc elasticsearch-master -n logs -p '{"spec": {"type": "LoadBalancer"}}'` | ||
* url: Any url. Optional. If not provided then it will default to the default knative borker in the namespace of the Seldon Deployment. | ||
* mode: Either `request`, `response` or `all` | ||
|
||
## Credits | ||
## Example Notebook | ||
|
||
Loosely based on https://www.katacoda.com/javajon/courses/kubernetes-observability/efk | ||
Fluentd filtering based on https://blog.ptrk.io/tweaking-an-efk-stack-on-kubernetes/ | ||
You can try out an [example notebook with logging](../examples/payload_logging.html) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"path": "../../../examples/models/metrics/metrics.ipynb" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"path": "../../../examples/models/payload_logging/payload_logging.ipynb" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"path": "../../../notebooks/protocol_examples.ipynb" | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"path": "../../../examples/models/tracing/tracing.ipynb" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Protocols | ||
|
||
Tensorflow protocol is only available in version >=1.1. | ||
|
||
Seldon Core supports the following data planes: | ||
|
||
* REST and gRPC Seldon protocol | ||
* REST and gRPC Tensorflow Serving Protocol | ||
|
||
## REST and gRPC Seldon Protocol | ||
|
||
* [REST Seldon Protocol](../reference/apis/index.html) | ||
|
||
Seldon is the default protocol for SeldonDeployment resources. You can specify the gRPC protocol by setting `transport: grpc` in your SeldonDeployment resource or ensuring all components in the graph have endpoint.tranport set ot grpc. | ||
|
||
See [example notebook](../examples/protcol_examples.html). | ||
|
||
## REST and gRPC Tensorflow Protocol | ||
|
||
* [REST Tensorflow Protocol definition](https://github.com/tensorflow/serving/blob/master/tensorflow_serving/g3doc/api_rest.md). | ||
* [gRPC Tensorflow Procotol definition](https://github.com/tensorflow/serving/blob/master/tensorflow_serving/apis/prediction_service.proto). | ||
|
||
Activate this protocol by speicfying `protocol: tensorflow` and `transport: rest` or `transport: grpc` in your Seldon Deployment. See [example notebook](../examples/protcol_examples.html). | ||
|
||
For Seldon graphs the protocol will work as expected for single model graphs for Tensorflow Serving servers running as the single model in the graph. For more complex graphs you can chain models: | ||
|
||
* Sending the response from the first as a request to the second. This will be done automatically when you defined a chain of models as a Seldon graph. It is up to the user to ensure the response of each changed model can be fed a request to the next in the chain. | ||
* Only Predict calls can be handled in multiple model chaining. | ||
|
||
General considerations: | ||
|
||
* Seldon components marked as MODELS, INPUT_TRANSFORMER and OUTPUT_TRANSFORMERS will allow a PredictionService Predict method to be called. | ||
* GetModelStatus for any model in the graph is available. | ||
* GetModelMetadata for any model in the graph is available. | ||
* Combining and Routing with the Tensorflow protocol is not presently supported. | ||
|
||
|
Oops, something went wrong.