-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apply new Standard Ensembler routing policy with Custom Experiment Engines #237
Apply new Standard Ensembler routing policy with Custom Experiment Engines #237
Conversation
f539d5f
to
1efe78c
Compare
api/api/specs/routers.yaml
Outdated
route_name_path: | ||
type: "string" | ||
pattern: '^\w*(?:\.\w+)*$' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This regex pattern here allows only period-delimited words of letters (or underscores) to be accepted as a valid route_name_path
. Specifying this here also dispenses the need for manually crafting regex checks on the API for this field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oooh what if the nested path actually has a key with "-" in it? Shall we remove this check and keep it flexible like the TrafficRuleCondition
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm if it's just dashes we can make it ^[\w\-]*(?:\.[\w\-]+)*$
instead? Are you referring to field
within TrafficRuleCondition
? That one doesn't have any checks right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay as discussed earlier, I'll be removing the regex changes to allow users more flexibility (at their own discretion) at specifying the route path names. Any resultant errors from any incorrect parsing of the path would be returned by the router itself.
"image": "asia.gcr.io/gcp-project-id/echo:1.0.2", | ||
"resource_request": { | ||
"min_replica": 1, | ||
"max_replica": 2, | ||
"cpu_request": "200m", | ||
"memory_request": "256Mi" | ||
}, | ||
"endpoint": "echo?delay=10ms", | ||
"timeout": "2s", | ||
"port": 8080, | ||
"env": [ | ||
{ | ||
"name": "TEST_ENV", | ||
"value": "ensembler" | ||
} | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the schema to reflect the current schema of an ensembler. The previous schema was incorrect but it didn't break anything because another (earlier) section of the router config was causing the test to fail as expected.
testEnsembler models.Ensembler | ||
err string | ||
}{ | ||
"failure | both experiment mappings and route name path are set": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe a positive to test case to ensure it is passing when expected to be?
755d8f1
to
7f1c050
Compare
06355c0
to
12b24e1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the whole, the PR looks good! Thanks for meticulously updating all the test scenarios too. I left some small comments. Will have another quick look once they are reviewed / addressed.
api/e2e/test/09_deploy_router_with_route_name_path_std_ensembler_test.go
Outdated
Show resolved
Hide resolved
...stdata/cluster/servicebuilder/router_version_success_std_ensembler_with_route_name_path.json
Outdated
Show resolved
Hide resolved
c4668b8
to
9ef2e8b
Compare
if ver.Ensembler.StandardConfig.ExperimentMappings != nil && | ||
len(ver.Ensembler.StandardConfig.ExperimentMappings) != 0 { | ||
propsMap["experiment_mappings"] = ver.Ensembler.StandardConfig.ExperimentMappings | ||
} | ||
if ver.Ensembler.StandardConfig.RouteNamePath != "" { | ||
propsMap["route_name_path"] = ver.Ensembler.StandardConfig.RouteNamePath | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These conditional statements ensure that only non-nil/non-empty values are passed to the fiber config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for the changes.
Since we haven't yet added the route_name_path
to the SDK, can we do that in a separate PR? https://github.com/caraml-dev/turing/blob/main/sdk/turing/router/config/router_ensembler_config.py#L35
…d route name path are not both set
…nly when docker/pyfunc types are used
…lers with route name path
…validation checks
d397131
to
c0c66db
Compare
Thanks a lot for reviewing the PR and for all the comments! I'll be merging this right now and will be following up with a separate PR for the SDK-related changes and e2e tests! 🚀🚀 |
Context
With the introduction of changes to the routing strategy of the Turing Router to support Standard Ensemblers for Custom Experiment Engines in #233, this PR introduces follow-up modifications to allow the API to set up Turing Routers that use a Standard Ensembler and a Custom Experiment Engine. The API also performs additional validation checks to ensure that any router create/update request payload does not contain both
experiment_mappings
androute_name_path
specified in theEnsemblerStandardConfig
.Minor Fixes
This PR also includes the replacement of deprecated
io/util
functions fromgo 1.16/1.17
with their correspondingio
oros
counterparts:ioutil.NopCloser
->io.NopCloser
ioutil.ReadAll
->io.ReadAll
ioutil.ReadFile
->os.ReadFile
ioutil.TempFile
->os.CreateTemp
ioutil.WriteFile
->os.WriteFile
Main Modifications
api/api/specs/routers.yaml
- Addition of theroute_name_path
field toEnsemblerStandardConfig
api/turing/api/request/request.go
- Addition of validation step to ensureExperimentMappings
andRouteNamePath
are not both set at the same timeapi/turing/cluster/servicebuilder/router.go
- Addition of step to addroute_name_path
to the config map that will be used by the Turing Router upon deploymentapi/turing/models/ensembler.go
- Addition ofRouteNamePath
to the db modelEnsemblerStandardConfig
structFuture Changes (Not included in this PR)
route_name_path
field to Standard Ensemblers within the Turing SDK