-
Notifications
You must be signed in to change notification settings - Fork 9
Dynamically set capabilities endpoint based on configuration #281
Dynamically set capabilities endpoint based on configuration #281
Conversation
resolves #279 |
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 - awesome!
...rest-scorer/src/main/java/ai/h2o/mojos/deploy/local/rest/controller/ModelsApiController.java
Show resolved
Hide resolved
...rest-scorer/src/main/java/ai/h2o/mojos/deploy/local/rest/controller/ModelsApiController.java
Outdated
Show resolved
Hide resolved
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 - tests seem valid 👍🏾. Added some notes to help curb the workarounds or improve maintainability.
...rest-scorer/src/main/java/ai/h2o/mojos/deploy/local/rest/controller/ModelsApiController.java
Outdated
Show resolved
Hide resolved
...rest-scorer/src/main/java/ai/h2o/mojos/deploy/local/rest/controller/ModelsApiController.java
Outdated
Show resolved
Hide resolved
...-scorer/src/test/java/ai/h2o/mojos/deploy/local/rest/controller/ModelsApiControllerTest.java
Outdated
Show resolved
Hide resolved
...-scorer/src/test/java/ai/h2o/mojos/deploy/local/rest/controller/ModelsApiControllerTest.java
Show resolved
Hide resolved
|
||
private static void mockDummyPipeline() { | ||
MojoPipeline dummyPipeline = | ||
new DummyPipeline(TEST_UUID, MojoFrameMeta.getEmpty(), MojoFrameMeta.getEmpty()); |
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.
I wonder if our static mock troubles would be fixed if we moved the loadMojoPipelineFromFile()
call in MojoScorer.java
from static to the constructor.
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... Seems like a bigger rework than I'm inclined to tackle at the moment.
@BeforeAll | ||
static void setup() { | ||
System.setProperty("mojo.path", "src/test/resources/multinomial-pipeline.mojo"); | ||
mockDummyPipeline(); |
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.
Doesn't look like the static mock session was closed. Not a big deal since the class is small and each test relies on this.
But for thoroughness, I'll share a couple of ways through this:
- Perform staticmock as part of a
try()
at the place it's needed, which auto cleans up the mock after use. Example. - Save the mock to a static variable and close the session as part of a
@AfterAll
.
...-scorer/src/test/java/ai/h2o/mojos/deploy/local/rest/controller/ModelsApiControllerTest.java
Outdated
Show resolved
Hide resolved
Thanks will fix and merge I think. |
Small improvement to
/model/capabilities
endpoint. No longer hardcoded. Pulls configuration from the scorer and uses that to set the response.