Skip to content

Commit c14593a

Browse files
fangyuefytillrohrmann
authored andcommitted
[FLINK-14393][webui] Add an option to enable/disable cancel job in web ui
This closes #15817.
1 parent 89c6c03 commit c14593a

File tree

17 files changed

+99
-15
lines changed

17 files changed

+99
-15
lines changed

docs/content.zh/docs/deployment/config.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ You can configure checkpointing directly in code within your Flink job or applic
8080
**Web UI**
8181

8282
- `web.submit.enable`: Enables uploading and starting jobs through the Flink UI *(true by default)*. Please note that even when this is disabled, session clusters still accept jobs through REST requests (HTTP calls). This flag only guards the feature to upload jobs in the UI.
83+
- `web.cancel.enable`: Enables canceling jobs through the Flink UI *(true by default)*. Please note that even when this is disabled, session clusters still cancel jobs through REST requests (HTTP calls). This flag only guards the feature to cancel jobs in the UI.
8384
- `web.upload.dir`: The directory where to store uploaded jobs. Only used when `web.submit.enable` is true.
8485

8586
**Other**

docs/content/docs/deployment/config.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ You can configure checkpointing directly in code within your Flink job or applic
8080
**Web UI**
8181

8282
- `web.submit.enable`: Enables uploading and starting jobs through the Flink UI *(true by default)*. Please note that even when this is disabled, session clusters still accept jobs through REST requests (HTTP calls). This flag only guards the feature to upload jobs in the UI.
83+
- `web.cancel.enable`: Enables canceling jobs through the Flink UI *(true by default)*. Please note that even when this is disabled, session clusters still cancel jobs through REST requests (HTTP calls). This flag only guards the feature to cancel jobs in the UI.
8384
- `web.upload.dir`: The directory where to store uploaded jobs. Only used when `web.submit.enable` is true.
8485
- `web.exception-history-size`: Sets the size of the exception history that prints the most recent failures that were handled by Flink for a job.
8586

docs/layouts/shortcodes/generated/rest_v1_dispatcher.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@
103103
"properties" : {
104104
"web-submit" : {
105105
"type" : "boolean"
106+
},
107+
"web-cancel" : {
108+
"type" : "boolean"
106109
}
107110
}
108111
},

docs/layouts/shortcodes/generated/web_configuration.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
<td>String</td>
1515
<td>Access-Control-Allow-Origin header for all responses from the web-frontend.</td>
1616
</tr>
17+
<tr>
18+
<td><h5>web.cancel.enable</h5></td>
19+
<td style="word-wrap: break-word;">true</td>
20+
<td>Boolean</td>
21+
<td>Flag indicating whether jobs can be canceled from the web-frontend.</td>
22+
</tr>
1723
<tr>
1824
<td><h5>web.checkpoints.history</h5></td>
1925
<td style="word-wrap: break-word;">10</td>

flink-core/src/main/java/org/apache/flink/configuration/WebOptions.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,14 @@ public class WebOptions {
117117
.withDescription(
118118
"Flag indicating whether jobs can be uploaded and run from the web-frontend.");
119119

120+
/** Config parameter indicating whether jobs can be cancel from the web-frontend. */
121+
public static final ConfigOption<Boolean> CANCEL_ENABLE =
122+
key("web.cancel.enable")
123+
.booleanType()
124+
.defaultValue(true)
125+
.withDescription(
126+
"Flag indicating whether jobs can be canceled from the web-frontend.");
127+
120128
/** Config parameter defining the number of checkpoints to remember for recent history. */
121129
public static final ConfigOption<Integer> CHECKPOINTS_HISTORY_SIZE =
122130
key("web.checkpoints.history")

flink-dist/src/main/resources/flink-conf.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,11 @@ jobmanager.execution.failover-strategy: region
160160

161161
#web.submit.enable: false
162162

163+
# Flag to specify whether job cancellation is enabled from the web-based
164+
# runtime monitor. Uncomment to disable.
165+
166+
#web.cancel.enable: false
167+
163168
#==============================================================================
164169
# Advanced
165170
#==============================================================================

flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/history/HistoryServer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ private void createDashboardConfigFile() throws IOException {
327327
fw.write(
328328
createConfigJson(
329329
DashboardConfiguration.from(
330-
webRefreshIntervalMillis, ZonedDateTime.now(), false)));
330+
webRefreshIntervalMillis, ZonedDateTime.now(), false, false)));
331331
fw.flush();
332332
} catch (IOException ioe) {
333333
LOG.error("Failed to write config file.");

flink-runtime-web/src/test/resources/rest_api_v1.snapshot

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@
5555
"properties" : {
5656
"web-submit" : {
5757
"type" : "boolean"
58+
},
59+
"web-cancel" : {
60+
"type" : "boolean"
5861
}
5962
}
6063
}

flink-runtime-web/web-dashboard/src/app/interfaces/configuration.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@ export interface ConfigurationInterface {
2424
'flink-revision': string;
2525
features: {
2626
'web-submit': boolean;
27+
'web-cancel': boolean;
2728
};
2829
}

flink-runtime-web/web-dashboard/src/app/pages/job/status/job-status.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ <h2>{{ jobDetail.name }}</h2>
5151
<div class="operate">
5252
<span *ngIf="statusTips">{{ statusTips }}</span>
5353
<ng-container *ngIf="!statusTips">
54-
<a nz-popconfirm nzTitle="Cancel Job?" (nzOnConfirm)="cancelJob()" *ngIf="jobDetail.state=='RUNNING' || jobDetail.state=='CREATED' || jobDetail.state=='RESTARTING'">Cancel Job</a>
54+
<a nz-popconfirm nzTitle="Cancel Job?" (nzOnConfirm)="cancelJob()" *ngIf="webCancelEnabled && (jobDetail.state=='RUNNING' || jobDetail.state=='CREATED' || jobDetail.state=='RESTARTING')">Cancel Job</a>
5555
</ng-container>
5656
</div>
5757
</div>

0 commit comments

Comments
 (0)