mxm commented on code in PR #740:
URL: 
https://github.com/apache/flink-kubernetes-operator/pull/740#discussion_r1448896925


##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/service/AbstractFlinkService.java:
##########
@@ -369,16 +370,17 @@ protected void cancelJob(
                         deleteClusterDeployment(
                                 deployment.getMetadata(), deploymentStatus, 
conf, true);
                     }
+                    
deploymentStatus.getJobStatus().setState(JobStatus.FINISHED.name());
                     break;
                 case LAST_STATE:
                     deleteClusterDeployment(
                             deployment.getMetadata(), deploymentStatus, conf, 
false);
+                    
deploymentStatus.getJobStatus().setState(JobStatus.FINISHED.name());
                     break;
                 default:
                     throw new RuntimeException("Unsupported upgrade mode " + 
upgradeMode);
             }
         }
-        deploymentStatus.getJobStatus().setState(JobStatus.FINISHED.name());

Review Comment:
   Could we remove all the FINISHED/CANCELED setters and move them into a 
method `setJobState(upgradeMode)` and then handle the different cases? That way 
we call the method once here, without having to remember to set the state after 
each operation.
   
   ```java
   void setJobState(UpgradeMode upgradeMode) {
      if (upgradeMode == STATELESS) {
        // set to cancelled
      } else if (upgradeMode == LAST_STATE) {
       // set to FINISHED
     } ...
   }
   ```



-- 
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]

Reply via email to