Skip to content

Commit

Permalink
[FLINK-28313][rest] Add history server flag to DashboardConfiguration
Browse files Browse the repository at this point in the history
This closes apache#20142.
  • Loading branch information
KarmaGYZ committed Jul 6, 2022
1 parent 03a1a42 commit a4540fe
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 8 deletions.
3 changes: 3 additions & 0 deletions docs/layouts/shortcodes/generated/rest_v1_dispatcher.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@
"web-cancel" : {
"type" : "boolean"
},
"web-history" : {
"type" : "boolean"
},
"web-submit" : {
"type" : "boolean"
}
Expand Down
2 changes: 2 additions & 0 deletions docs/static/generated/rest_v1_dispatcher.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2705,6 +2705,8 @@ components:
type: boolean
web-cancel:
type: boolean
web-history:
type: boolean
JobVertexTaskManagersInfo:
type: object
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,11 @@ private void createDashboardConfigFile() throws IOException {
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.");
Expand Down
3 changes: 3 additions & 0 deletions flink-runtime-web/src/test/resources/rest_api_v1.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@
},
"web-cancel" : {
"type" : "boolean"
},
"web-history" : {
"type" : "boolean"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ public DashboardConfigHandler(

dashboardConfiguration =
DashboardConfiguration.from(
refreshInterval, ZonedDateTime.now(), webSubmitEnabled, webCancelEnabled);
refreshInterval,
ZonedDateTime.now(),
webSubmitEnabled,
webCancelEnabled,
false);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -121,12 +123,17 @@ public static final class Features {
@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
Expand All @@ -139,6 +146,11 @@ public boolean isWebCancelEnabled() {
return webCancelEnabled;
}

@JsonIgnore
public boolean isHistoryServer() {
return isHistoryServer;
}

@Override
public boolean equals(Object o) {
if (this == o) {
Expand All @@ -149,12 +161,13 @@ public boolean equals(Object o) {
}
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);
}
}

Expand Down Expand Up @@ -190,7 +203,8 @@ public static DashboardConfiguration from(
long refreshInterval,
ZonedDateTime zonedDateTime,
boolean webSubmitEnabled,
boolean webCancelEnabled) {
boolean webCancelEnabled,
boolean isHistoryServer) {

final String flinkVersion = EnvironmentInformation.getVersion();

Expand All @@ -212,6 +226,6 @@ public static DashboardConfiguration from(
zonedDateTime.toOffsetDateTime().getOffset().getTotalSeconds() * 1000,
flinkVersion,
flinkRevision,
new Features(webSubmitEnabled, webCancelEnabled));
new Features(webSubmitEnabled, webCancelEnabled, isHistoryServer));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ protected DashboardConfiguration getTestResponseInstance() {
42,
"version",
"revision",
new DashboardConfiguration.Features(true, true));
new DashboardConfiguration.Features(true, true, false));
}
}

0 comments on commit a4540fe

Please sign in to comment.