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
[FLINK-7647] [flip6] Port JobManagerConfigHandler to new REST endpoint #4691
Conversation
Thanks for your contribution @tzulitai. There are still some checkstyle violations in the code. |
This commit lets the JobManagerConfigHandler implement the LegacyRestHandler interface in order to be ported to the new REST endpoint. This includes the introduction of ClusterConfiguration response body and ClusterConfigurationHeaders. The DispatcherRestEndpoint now also registers the JobManagerConfigHandler.
16902cc
to
288d974
Compare
@tillrohrmann I've corrected checkstyles violations and rebased. |
…andler The original naming wouldn't make sense for the FLIP-6 redesign, since we would have multiple per-job JobManagers for each cluster, which shares the same configuration. The REST path is still left untouched and not part of this commit, as that would involve more changes in flink-runtime-web.
Introduces a common test base that for all REST responses, a subclass should be implemented to verify that the response can be correctly marshalled and unmarshalled.
288d974
to
642e488
Compare
Still failing with |
Sorry about that, local Travis tests pass, should be fine now. |
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.
Changes look good to me @tzulitai. I had only minor comments. After addressing them, we can merge this PR :-)
private final RestHandlerConfiguration restConfiguration; | ||
private final Executor executor; | ||
|
||
public DispatcherRestEndpoint( | ||
RestServerEndpointConfiguration configuration, | ||
Configuration clusterConfiguration, | ||
RestServerEndpointConfiguration endpointConfiguration, |
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.
Shall we remove the order between clusterConfiguration
and endpointConfiguration
? I usually like to have the super class arguments first.
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.
Will change.
HandlerRequest<EmptyRequestBody, EmptyMessageParameters> request, | ||
DispatcherGateway gateway) { | ||
|
||
return CompletableFuture.supplyAsync(() -> ClusterConfiguration.from(config), executor); |
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 we could generate the ClusterConfiguration
instance once at creation time and then always return this element as a CompletableFuture.completedFuture(clusterConfiguration)
.
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.
That makes a lot of sense, yes. Will change.
* Response of the {@link ClusterConfigHandler}, respresented as a list | ||
* of key-value pairs of the cluster {@link Configuration}. | ||
*/ | ||
public class ClusterConfiguration extends ArrayList<ClusterConfigurationEntry> implements ResponseBody { |
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.
Serial version uid missing.
* Response of the {@link ClusterConfigHandler}, respresented as a list | ||
* of key-value pairs of the cluster {@link Configuration}. | ||
*/ | ||
public class ClusterConfiguration extends ArrayList<ClusterConfigurationEntry> implements ResponseBody { |
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.
There is already another class called ClusterConfiguration
. Maybe we should rename it in order to disambiguate it.
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'll rename this to ClusterConfigurationInfo
.
* Response of the {@link ClusterConfigHandler}, respresented as a list | ||
* of key-value pairs of the cluster {@link Configuration}. | ||
*/ | ||
public class ClusterConfiguration extends ArrayList<ClusterConfigurationEntry> implements ResponseBody { |
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'm actually wondering why we don't extend from a Map
implementation since it should behave more like a map. This of course would require changes on the web gui side. I think now, the JSON would like
[{"key":"keyvalue", "value":"valuevalue"}, {....}]
instead of
{"keyvalue":"valuevalue", ....}
Maybe we could change this in the future.
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.
Yes, I found the original use of the JSONArray structure very strange also.
We can include a change for this probably when we also re-work the REST resource path for this handler.
Thanks a lot for the review @tillrohrmann. I'll go ahead and merge this PR after addressing your comments. |
Introduces a common test base that for all REST responses, a subclass should be implemented to verify that the response can be correctly marshalled and unmarshalled. This closes apache#4691. This closes apache#4720.
Introduces a common test base that for all REST responses, a subclass should be implemented to verify that the response can be correctly marshalled and unmarshalled. This closes apache#4691. This closes apache#4720.
Introduces a common test base that for all REST responses, a subclass should be implemented to verify that the response can be correctly marshalled and unmarshalled. This closes apache#4691. This closes apache#4720.
What is the purpose of the change
This PR ports the existing
JobManagerConfigHandler
to the new REST endpoint. This includes introducing theClusterConfiguration
response andClusterConfigurationHeaders
. TheDispatcherRestEndpoint
now registers theJobManagerConfigHandler
.Additionally, this PR also contains other cosmetic changes, such as properly renaming the
JobManagerConfigHandler
toClusterConfigHandler
, and refactoring common test logic for marshalling / unmarshalling of REST responses.Brief change log
JobManagerConfigHandler
implementLegacyRestEHandler
JobManagerConfigHandler
atDispatcherRestEndpoint
JobManagerConfigHandler
toClusterConfigHandler
RestResponseMarshallingTestBase
Verifying this change
This change is a trivial rework / code cleanup.
Only additional test is
ClusterConfigurationTest
for the marshalling of theClusterConfiguration
.Does this pull request potentially affect one of the following parts:
@Public(Evolving)
: noDocumentation