You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add turing_req_id in requests made to Turing Router components (#230)
* Add turing request id to requests sent to router components
* Replace deprecated ioutil.ReadAll function with io.ReadAll
* Fix http handler test
* Add mention of turing_req_id to docs
* Add sample of how turing_req_id is accessed in the pyfunc ensembler
* Rename turing_req_id in docs to Turing-Req-Id
Copy file name to clipboardExpand all lines: docs/how-to/create-a-router/configure-enricher.md
+6-1Lines changed: 6 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,12 @@ The Turing enricher has the ability to perform arbitrary transformations on the
10
10
Original request will be sent to configured routes without enrichment.
11
11
12
12
### Docker
13
-
Turing will deploy specified Docker image as a pre-processor and will send original request to it for enrichment. To configure a Docker enricher, there are 3 sections to fill.
13
+
Turing will deploy specified Docker image as a pre-processor and will send original request to it for enrichment.
14
+
15
+
The request to the enricher is constructed from the request headers to the Router, and an identifier `Turing-Req-Id`
16
+
that is uniquely assigned to each request received by the Router.
17
+
18
+
To configure a Docker enricher, there are 3 sections to fill.
14
19
15
20
Configure the Docker Container. There are 4 required inputs.
Copy file name to clipboardExpand all lines: docs/how-to/create-a-router/configure-ensembler.md
+18-4Lines changed: 18 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,14 @@ It is not possible to select as the fallback response a route that has traffic r
26
26
{% endhint %}
27
27
28
28
## Docker
29
-
Turing will deploy the specified image as a post-processor and will send in the request payload the following, for ensembling - the original request, responses from all routes, and the treatment configuration (if an Experiment Engine is selected, in Configure Experiment Engine). The ensembler's request headers will contain the original request headers sent to Turing, merged with the enricher's response headers (if there are duplicates, the value in the enricher's response headers will take precedence). To configure a Docker ensembler, there are 3 sections to be filled.
29
+
30
+
Turing will deploy the specified image as a post-processor and will send in the request payload the following, for
31
+
ensembling - the original request, responses from all routes, and the treatment configuration (if an Experiment
32
+
Engine is selected, in the Configure Experiment Engine step). The ensembler's request headers will contain the original
33
+
request headers sent to Turing, merged with the enricher's response headers (if there are duplicates, the value in
34
+
the enricher's response headers will take precedence), and an identifier `Turing-Req-Id` that is uniquely assigned to each request received by the Router.
35
+
36
+
To configure a Docker ensembler, there are 3 sections to be filled.
30
37
31
38
Configure the Docker Container. There are 4 required inputs.
32
39
@@ -57,20 +64,26 @@ Configure the resources required for the ensembler. There are 3 required inputs,
57
64
**Min/Max Replicas**: Min/max number of replicas for your ensembler. Scaling of the ensembler based on traffic volume will be automatically done for you.
58
65
59
66
## Pyfunc Ensembler
60
-
Turing will deploy a previously registered pyfunc ensembler (refer to
67
+
Turing will deploy a previously registered Pyfunc ensembler (refer to
61
68
[the samples](https://github.com/caraml-dev/turing/tree/main/sdk/samples) in the SDK section for more information on how to
62
69
deploy one) as a containerised web service.
63
70
64
71
This allows you to simply define the logic required for the ensembling
65
72
step by implementing a Python `mlflow`-based interface, and rely on Turing API to containerise and package your
66
73
implementation as an entire web service automatically.
67
74
75
+
Similar to requests sent to a Docker Ensembler, the request payload sent to a Pyfunc ensembler will contain the
76
+
original request, responses from all routes, and the treatment configuration (if an Experiment
77
+
Engine is selected, in the Configure Experiment Engine step). The ensembler's request headers will contain the original
78
+
request headers sent to Turing, merged with the enricher's response headers (if there are duplicates, the value in
79
+
the enricher's response headers will take precedence), and an identifier `Turing-Req-Id` that is uniquely assigned to each request received by the Router.
80
+
68
81
To configure your router with a Pyfunc ensembler, simply select from the drop down list your desired ensembler,
69
82
registered in your current project. You'll also need to indicate your desired timeout value and resource request values:
**Pyfunc Ensembler**: The name of the pyfunc ensembler that has been deployed in your *current* project
86
+
**Pyfunc Ensembler**: The name of the Pyfunc ensembler that has been deployed in your *current* project
74
87
75
88
**Timeout**: Request timeout, which when exceeded, the request to the ensembler will be terminated
76
89
@@ -87,7 +100,8 @@ The router will send responses from all routes, together with treatment configur
87
100
88
101
89
102
## Ensembler Request Payload Format
90
-
When the ensembler type is Docker/External, the ensembler will receive the following information in the request payload and the behaviour of the ensembler is up to the implementer.
103
+
When the ensembler type is Docker/Pyfunc/External, the ensembler will receive the following information in the request
104
+
payload and the behaviour of the ensembler is up to the implementer.
Copy file name to clipboardExpand all lines: docs/how-to/create-a-router/configure-experiment-engine.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,10 @@
4
4
This step is **optional** and the default behaviour will be to send the request to all of the configured routes, but the response from Turing will depend on the Ensembler configuration.
5
5
{% endhint %}
6
6
7
+
The request sent to the experiment engine is constructed from the request headers to the Router (including an
8
+
identifier `Turing-Req-Id` that is uniquely assigned to each request received by the Router), and either the request
9
+
body to the Router (if there is no Enricher) or the response body from the Enricher (if enabled).
10
+
7
11
If you intend to determine how to select/combine responses from the individual routes (typically in the Ensembler) to send back as the Turing response, configure the Experiment Engine as shown in Configure Experiment Engine.
Copy file name to clipboardExpand all lines: docs/how-to/create-a-router/configure-routes.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,10 @@
2
2
3
3
Routes are an essential part of your Turing Router setup. Each route is defined by its ID and the endpoint. A route can be your deployed ML model, exposed via HTTP interface, or an arbitrary non-ML web-service. Each router should be configured with at least one route and each route's ID should be unique among other routes of this router.
4
4
5
+
The request sent to the each route is constructed from the request headers to the Router (including an
6
+
identifier `Turing-Req-Id` that is uniquely assigned to each request received by the Router), and either the request
7
+
body to the Router (if there is no Enricher) or the response body from the Enricher (if enabled).
0 commit comments