This is an automated email from the ASF dual-hosted git repository. guoyangze pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/master by this push: new a4540fea6bc [FLINK-28313][rest] Add history server flag to DashboardConfiguration a4540fea6bc is described below commit a4540fea6bc2ef4ded6007563480820fcc12ecc0 Author: Yangze Guo <karma...@gmail.com> AuthorDate: Wed Jun 8 14:39:17 2022 +0800 [FLINK-28313][rest] Add history server flag to DashboardConfiguration This closes #20142. --- .../shortcodes/generated/rest_v1_dispatcher.html | 3 +++ docs/static/generated/rest_v1_dispatcher.yml | 2 ++ .../runtime/webmonitor/history/HistoryServer.java | 6 +++++- .../src/test/resources/rest_api_v1.snapshot | 3 +++ .../handler/cluster/DashboardConfigHandler.java | 6 +++++- .../rest/messages/DashboardConfiguration.java | 24 +++++++++++++++++----- .../rest/messages/DashboardConfigurationTest.java | 2 +- 7 files changed, 38 insertions(+), 8 deletions(-) diff --git a/docs/layouts/shortcodes/generated/rest_v1_dispatcher.html b/docs/layouts/shortcodes/generated/rest_v1_dispatcher.html index 91d4a2c6667..eb862ac83bf 100644 --- a/docs/layouts/shortcodes/generated/rest_v1_dispatcher.html +++ b/docs/layouts/shortcodes/generated/rest_v1_dispatcher.html @@ -104,6 +104,9 @@ "web-cancel" : { "type" : "boolean" }, + "web-history" : { + "type" : "boolean" + }, "web-submit" : { "type" : "boolean" } diff --git a/docs/static/generated/rest_v1_dispatcher.yml b/docs/static/generated/rest_v1_dispatcher.yml index 13fe5fb0d42..2836526421e 100644 --- a/docs/static/generated/rest_v1_dispatcher.yml +++ b/docs/static/generated/rest_v1_dispatcher.yml @@ -2705,6 +2705,8 @@ components: type: boolean web-cancel: type: boolean + web-history: + type: boolean JobVertexTaskManagersInfo: type: object properties: diff --git a/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/history/HistoryServer.java b/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/history/HistoryServer.java index 7f7a1700708..cd4ab2d3071 100644 --- a/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/history/HistoryServer.java +++ b/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/history/HistoryServer.java @@ -349,7 +349,11 @@ public class HistoryServer { fw.write( createConfigJson( DashboardConfiguration.from( - webRefreshIntervalMillis, ZonedDateTime.now(), false, false))); + webRefreshIntervalMillis, + ZonedDateTime.now(), + false, + false, + true))); fw.flush(); } catch (IOException ioe) { LOG.error("Failed to write config file."); diff --git a/flink-runtime-web/src/test/resources/rest_api_v1.snapshot b/flink-runtime-web/src/test/resources/rest_api_v1.snapshot index faa2dc418ed..144f4e774eb 100644 --- a/flink-runtime-web/src/test/resources/rest_api_v1.snapshot +++ b/flink-runtime-web/src/test/resources/rest_api_v1.snapshot @@ -58,6 +58,9 @@ }, "web-cancel" : { "type" : "boolean" + }, + "web-history" : { + "type" : "boolean" } } } diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/cluster/DashboardConfigHandler.java b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/cluster/DashboardConfigHandler.java index 8d212d24918..caae3c14f92 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/cluster/DashboardConfigHandler.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/cluster/DashboardConfigHandler.java @@ -54,7 +54,11 @@ public class DashboardConfigHandler dashboardConfiguration = DashboardConfiguration.from( - refreshInterval, ZonedDateTime.now(), webSubmitEnabled, webCancelEnabled); + refreshInterval, + ZonedDateTime.now(), + webSubmitEnabled, + webCancelEnabled, + false); } @Override diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/DashboardConfiguration.java b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/DashboardConfiguration.java index b124756cc0e..b3cfa4fb47d 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/DashboardConfiguration.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/DashboardConfiguration.java @@ -48,6 +48,8 @@ public class DashboardConfiguration implements ResponseBody { public static final String FIELD_NAME_FEATURE_WEB_CANCEL = "web-cancel"; + public static final String FIELD_NAME_FEATURE_WEB_HISTORY = "web-history"; + @JsonProperty(FIELD_NAME_REFRESH_INTERVAL) private final long refreshInterval; @@ -121,12 +123,17 @@ public class DashboardConfiguration implements ResponseBody { @JsonProperty(FIELD_NAME_FEATURE_WEB_CANCEL) private final boolean webCancelEnabled; + @JsonProperty(FIELD_NAME_FEATURE_WEB_HISTORY) + private final boolean isHistoryServer; + @JsonCreator public Features( @JsonProperty(FIELD_NAME_FEATURE_WEB_SUBMIT) boolean webSubmitEnabled, - @JsonProperty(FIELD_NAME_FEATURE_WEB_CANCEL) boolean webCancelEnabled) { + @JsonProperty(FIELD_NAME_FEATURE_WEB_CANCEL) boolean webCancelEnabled, + @JsonProperty(FIELD_NAME_FEATURE_WEB_HISTORY) boolean isHistoryServer) { this.webSubmitEnabled = webSubmitEnabled; this.webCancelEnabled = webCancelEnabled; + this.isHistoryServer = isHistoryServer; } @JsonIgnore @@ -139,6 +146,11 @@ public class DashboardConfiguration implements ResponseBody { return webCancelEnabled; } + @JsonIgnore + public boolean isHistoryServer() { + return isHistoryServer; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -149,12 +161,13 @@ public class DashboardConfiguration implements ResponseBody { } Features features = (Features) o; return webSubmitEnabled == features.webSubmitEnabled - && webCancelEnabled == features.webCancelEnabled; + && webCancelEnabled == features.webCancelEnabled + && isHistoryServer == features.isHistoryServer; } @Override public int hashCode() { - return Objects.hash(webSubmitEnabled, webCancelEnabled); + return Objects.hash(webSubmitEnabled, webCancelEnabled, isHistoryServer); } } @@ -190,7 +203,8 @@ public class DashboardConfiguration implements ResponseBody { long refreshInterval, ZonedDateTime zonedDateTime, boolean webSubmitEnabled, - boolean webCancelEnabled) { + boolean webCancelEnabled, + boolean isHistoryServer) { final String flinkVersion = EnvironmentInformation.getVersion(); @@ -212,6 +226,6 @@ public class DashboardConfiguration implements ResponseBody { zonedDateTime.toOffsetDateTime().getOffset().getTotalSeconds() * 1000, flinkVersion, flinkRevision, - new Features(webSubmitEnabled, webCancelEnabled)); + new Features(webSubmitEnabled, webCancelEnabled, isHistoryServer)); } } diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/rest/messages/DashboardConfigurationTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/rest/messages/DashboardConfigurationTest.java index cdfc3a43a27..aec97d61c72 100644 --- a/flink-runtime/src/test/java/org/apache/flink/runtime/rest/messages/DashboardConfigurationTest.java +++ b/flink-runtime/src/test/java/org/apache/flink/runtime/rest/messages/DashboardConfigurationTest.java @@ -35,6 +35,6 @@ public class DashboardConfigurationTest 42, "version", "revision", - new DashboardConfiguration.Features(true, true)); + new DashboardConfiguration.Features(true, true, false)); } }