Skip to content
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

fix(ui): Fix incorrect steps to remove ensembler fields #382

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
Comment on lines -157 to -159
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This entire check was ineffective and was doing nothing since it was checking a field that doesn't exist - obj.config.ensembler.resource_request does not exist. The intended path should've been obj.config.ensembler.docker_config.resource_request or obj.config.ensembler.pyfunc_config.resource_request.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The delete is done is ensembler.is instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep that's right, because toJSON in Ensembler.js gets called after the entire return value of toJSON in TuringRouter.js gets returned.

}

// Outcome Logging
Expand Down
Loading