Introduce ability to scale supervisor through overlord's REST API#16350
Introduce ability to scale supervisor through overlord's REST API#16350ac9817 wants to merge 5 commits intoapache:masterfrom
Conversation
79913b2 to
2da3532
Compare
2da3532 to
d981e27
Compare
| @POST | ||
| @Path("/{id}/setTaskCount") | ||
| @Produces(MediaType.APPLICATION_JSON) | ||
| @ResourceFilters(SupervisorResourceFilter.class) | ||
| public Response setTaskCount(@PathParam("id") final String id, @QueryParam("taskCount") final Integer taskCount) |
There was a problem hiding this comment.
Instead of doing this via a new API that is scoped to just the taskCount field in the supervisor spec, can you update this API to be a PATCH request on .../supervisors/{id}
That would give us the flexibility to atomically update any field in the supervisor spec instead of needing a new API for each supervisor spec modification
There was a problem hiding this comment.
I agree, this would be better than what is currently being done in this PR.
But I am not sure why we need a separate API at all.
Couldn't this be an optimization in the existing specPost API itself?
- Post a supervisor spec
- If a supervisor already exists for the given id, we compare the spec against its current value.
- If the change is only in task count, don't go via the normal route and invoke
updateTaskCountmethod instead. - Even if we use the PATCH API route, we would still need a similar diff mechanism.
cc: @adithyachakilam , @suneet-s
There was a problem hiding this comment.
We are trying to avoid an extra GET call to get the actual existing spec to send to POST call. Also, the idea was to try libraries like https://github.com/java-json-tools/json-patch to support editing of any fields dynamically. But a standard PATCH controller seems like not availbale.
There was a problem hiding this comment.
What's the harm in doing a GET before the POST? It is not a very expensive operation.
In fact, it is desirable to know the current state before we try to update it.
and it could also change in between those calls.
This is always a possibility. Some other user could update the task count right after we updated it. Having a separate API does not protect against concurrent updates. Updating a supervisor spec is typically an admin action and is also audited. The likelihood of concurrent updates should be very low.
Also, the idea was to try libraries like https://github.com/java-json-tools/json-patch to support editing of any fields dynamically.
Being able to update separate fields is a valid requirement, but the library we end up using should not dictate the contract of our APIs.
@adithyachakilam , Could you please share some more details on the challenges with the current API?
There was a problem hiding this comment.
It is not a very expensive operation.
It does end up being expensive when we build automation solutions on top of it.
Some other user could update the task count right after we updated it.
Sure, In that case two sequential updates are done. But when we do a GET and a POST a valid user update made in between might be overridden.
but the library we end up using should not dictate the contract of our APIs.
It does follow of RFC 6902 (JSON Patch) and RFC 7386 (JSON Merge Patch) which are standard for patch requests merge specification.
|
@adithyachakilam , please add more details to the PR description:
|
62926a5 to
df408cd
Compare
df408cd to
d270ff2
Compare
|
Had an offline discussion with @adithyachakilam . If this is the requirement, then as @suneet-s suggests, we should have a separate API as follows:
@adithyachakilam , please let me know if this meets your needs. |
|
@kfaraz On another thought, We do want to make this as an persisted update. So it would not just be a approach 1: (current state of the PR)
approach 2:
Is there a way to implement an actual cc: @suneet-s |
|
This pull request has been marked as stale due to 60 days of inactivity. |
|
This pull request/issue has been closed due to lack of activity. If you think that |
Description
This PR introduces the ability to change the task count on the supervisor without the need to resubmit the spec. This could be used in cases where an user want to scale the supervisor depending on some external factors in his environment. In order to use the current post call, we need to do an extra get call for the current spec and it could also change in between those calls.
Key changed/added classes in this PR
SupervisorResourceSeekableStreamSupervisorSpecRelease Notes:
Introduces a new Supervisor API to update the task count with out getting to know the complete supervisor spec.
This PR has: