Improve validation of remote execution support#1898
Conversation
Currently, we allow passing remote execution fields on both standard and dedicated deployments. However, it is only truly supported at the moment for dedicated. Now, we always set the remote execution spec for hosted deployments, which means that if the user sets it on a standard deployment request, the api will return an error describing what's currently supported, vs silently not setting it.
3a0256c to
ccf6626
Compare
neel-astro
left a comment
There was a problem hiding this comment.
Left some minor comments, but otherwise LGTM
| } | ||
| } | ||
| switch schedulerSize { | ||
| switch schedulerSize { //nolint:dupl |
There was a problem hiding this comment.
Should this be a utility method instead of using nolint:dupl?
There was a problem hiding this comment.
It is not quite the same. There are a lot of dedicated vs standard references.
There was a problem hiding this comment.
ok, I think there is scope to improve still, generics could be one way to look at it. But not a blocker for this PR, as I already have a story incoming from the other nova to make these insane if/else blocks a bit simpler.
There was a problem hiding this comment.
Yes, 100%, but I don't want to increase the scope of this further. There's too much to clean up.
cloud/deployment/deployment.go
Outdated
| standardDeploymentRequest.SchedulerSize = astroplatformcore.CreateStandardDeploymentRequestSchedulerSizeEXTRALARGE | ||
| case "": | ||
| standardDeploymentRequest.SchedulerSize = astroplatformcore.CreateStandardDeploymentRequestSchedulerSize(configOption.DefaultValues.SchedulerSize) | ||
| if standardDeploymentRequest.RemoteExecution != nil && standardDeploymentRequest.RemoteExecution.Enabled { |
There was a problem hiding this comment.
Standard deployment should have remote execution as nil right? or am I missing something?
There was a problem hiding this comment.
Yes, theoretically, but the API spec doesn't tell us that. I discussed that with @ianbuss, and we think having less business logic (which it is if it is not part of the OpenAPI spec) is better.
There was a problem hiding this comment.
It is better to surface the raw API error rather than a possible outdated or inaccurate error message.
| } | ||
| } | ||
|
|
||
| func CreateDefaultTaskPodCPU(defaultTaskPodCPU string, isRemoteExecutionEnabled bool, configOption *astrocore.DeploymentOptions) *string { |
There was a problem hiding this comment.
nit: should we add unit tests for these new functions? Or are we sure that the existing test cases cover all possible variations?
There was a problem hiding this comment.
I have manually tested some of them, but UTs make sense to me actually, because they are public and shared between deployment.go and from_file.go. I will add some. Thank you!
| } | ||
| } | ||
| switch schedulerSize { | ||
| switch schedulerSize { //nolint:dupl |
There was a problem hiding this comment.
Nit: if you look at it, the case should be on the dedicated deployment request scheduler size small, and so on for the rest, i.e., dedicated instead of standard. Tiny thing in the existing codebase, but could lead to buggy code someday.
There was a problem hiding this comment.
Oh yeah, the refs are incorrect. Let's handle that on a different PR.
| } | ||
| } | ||
| switch schedulerSize { | ||
| switch schedulerSize { //nolint:dupl |
There was a problem hiding this comment.
ok, I think there is scope to improve still, generics could be one way to look at it. But not a blocker for this PR, as I already have a story incoming from the other nova to make these insane if/else blocks a bit simpler.
Description
Currently, we allow passing remote execution fields on both standard and dedicated deployments. However, it is only truly supported at the moment for dedicated. Now, we always set the remote execution spec for hosted deployments, which means that if the user sets it on a standard deployment request, the api will return an error describing what's currently supported, vs silently not setting it.
🎟 Issue(s)
Related #1895
🧪 Functional Testing
📸 Screenshots
📋 Checklist
make testbefore taking out of draftmake lintbefore taking out of draft