rgsriram commented on code in PR #438:
URL:
https://github.com/apache/flink-kubernetes-operator/pull/438#discussion_r1022717931
##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/service/AbstractFlinkService.java:
##########
@@ -362,11 +362,27 @@ public void cancelSessionJob(
FlinkSessionJob sessionJob, UpgradeMode upgradeMode, Configuration
conf)
throws Exception {
+ // Not allowing the jobs which are already in the completed state.
+ String[] jobStateCannotBeCancelled =
+ new String[] {
+ JobStatus.CANCELLING.name(),
+ JobStatus.CANCELED.name(),
+ JobStatus.FAILING.name(),
+ JobStatus.FAILED.name(),
+ JobStatus.FINISHED.name()
+ };
+
var jobStatus = sessionJob.getStatus().getJobStatus();
+
+ if
(Arrays.stream(jobStateCannotBeCancelled).anyMatch(jobStatus.getState()::contains))
{
+ throw new RuntimeException("Job is Already in " +
jobStatus.getState() + " state");
+ }
+
Review Comment:
Got your point. I thought of another way to handle it. I will fix this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]