Skip to content

Commit 91e2211

Browse files
Move ensembler deletion logic to ensembler tojson method (#382)
1 parent cbebbd6 commit 91e2211

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

ui/src/services/ensembler/Ensembler.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ export class Ensembler {
2727
toJSON() {
2828
switch (this.type) {
2929
case "docker":
30+
if (this.docker_config.resource_request?.cpu_limit === "") {
31+
delete this.docker_config.resource_request.cpu_limit;
32+
}
3033
return { type: this.type, docker_config: this.docker_config };
3134
case "standard":
3235
if (this.standard_config.experiment_mappings?.length === 0) {
@@ -35,11 +38,15 @@ export class Ensembler {
3538
if (this.standard_config.route_name_path === "") {
3639
delete this.standard_config.route_name_path;
3740
}
41+
delete this.standard_config.fallback_response_route_id;
3842
return { type: this.type, standard_config: this.standard_config };
3943
case "pyfunc":
44+
if (this.pyfunc_config.resource_request?.cpu_limit === "") {
45+
delete this.pyfunc_config.resource_request.cpu_limit;
46+
}
4047
return { type: this.type, pyfunc_config: this.pyfunc_config };
4148
default:
42-
return { ...this, nop_config: this.nop_config };
49+
return undefined;
4350
}
4451
}
4552
}

ui/src/services/router/TuringRouter.js

-12
Original file line numberDiff line numberDiff line change
@@ -138,25 +138,13 @@ export class TuringRouter {
138138
// Copy the final response route id to the top level, as the default route
139139
obj.config.default_route_id =
140140
obj.config["ensembler"].nop_config["final_response_route_id"];
141-
delete obj.config["ensembler"];
142141
} else if (obj.config.ensembler.type === "standard") {
143142
// Copy the fallback response route id to the top level, as the default route
144143
obj.config.default_route_id =
145144
obj.config["ensembler"].standard_config["fallback_response_route_id"];
146-
delete obj.config["ensembler"].standard_config[
147-
"fallback_response_route_id"
148-
];
149145
} else {
150146
// Docker or Pyfunc ensembler, clear the default_route_id
151147
delete obj.config["default_route_id"];
152-
if (obj.config.ensembler.type === "pyfunc") {
153-
// Delete the docker config
154-
delete obj.config["ensembler"].docker_config;
155-
}
156-
// Docker/Pyfunc ensembler CPU limit
157-
if (obj.config.ensembler.resource_request?.cpu_limit === "") {
158-
delete obj.config.ensembler.resource_request.cpu_limit;
159-
}
160148
}
161149

162150
// Outcome Logging

0 commit comments

Comments
 (0)