Skip to content

Commit

Permalink
Move ensembler deletion logic to ensembler tojson method (#382)
Browse files Browse the repository at this point in the history
  • Loading branch information
deadlycoconuts authored Jun 7, 2024
1 parent cbebbd6 commit 91e2211
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
9 changes: 8 additions & 1 deletion ui/src/services/ensembler/Ensembler.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ export class Ensembler {
toJSON() {
switch (this.type) {
case "docker":
if (this.docker_config.resource_request?.cpu_limit === "") {
delete this.docker_config.resource_request.cpu_limit;
}
return { type: this.type, docker_config: this.docker_config };
case "standard":
if (this.standard_config.experiment_mappings?.length === 0) {
Expand All @@ -35,11 +38,15 @@ export class Ensembler {
if (this.standard_config.route_name_path === "") {
delete this.standard_config.route_name_path;
}
delete this.standard_config.fallback_response_route_id;
return { type: this.type, standard_config: this.standard_config };
case "pyfunc":
if (this.pyfunc_config.resource_request?.cpu_limit === "") {
delete this.pyfunc_config.resource_request.cpu_limit;
}
return { type: this.type, pyfunc_config: this.pyfunc_config };
default:
return { ...this, nop_config: this.nop_config };
return undefined;
}
}
}
12 changes: 0 additions & 12 deletions ui/src/services/router/TuringRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,25 +138,13 @@ export class TuringRouter {
// Copy the final response route id to the top level, as the default route
obj.config.default_route_id =
obj.config["ensembler"].nop_config["final_response_route_id"];
delete obj.config["ensembler"];
} else if (obj.config.ensembler.type === "standard") {
// Copy the fallback response route id to the top level, as the default route
obj.config.default_route_id =
obj.config["ensembler"].standard_config["fallback_response_route_id"];
delete obj.config["ensembler"].standard_config[
"fallback_response_route_id"
];
} else {
// Docker or Pyfunc ensembler, clear the default_route_id
delete obj.config["default_route_id"];
if (obj.config.ensembler.type === "pyfunc") {
// Delete the docker config
delete obj.config["ensembler"].docker_config;
}
// Docker/Pyfunc ensembler CPU limit
if (obj.config.ensembler.resource_request?.cpu_limit === "") {
delete obj.config.ensembler.resource_request.cpu_limit;
}
}

// Outcome Logging
Expand Down

0 comments on commit 91e2211

Please sign in to comment.