vsinghal85 commented on code in PR #4076:
URL: https://github.com/apache/gobblin/pull/4076#discussion_r1848020777


##########
gobblin-service/src/main/java/org/apache/gobblin/service/modules/orchestration/Orchestrator.java:
##########
@@ -138,26 +138,23 @@ public AddSpecResponse onAddSpec(Spec addedSpec) {
   }
 
   /*
-    validates if lease can be acquired on the provided flowSpec,
-    else throw LeaseUnavailableException
+    enforces that a similar flow is not launching,
+    else throw TooSoonToRerunSameFlowException
    */
-  private void validateAdhocFlowLeasability(FlowSpec flowSpec) {
+  private void enforceSimilarAdhocFlowExistence(FlowSpec flowSpec) {
     if (!flowSpec.isScheduled()) {
       Config flowConfig = flowSpec.getConfig();
       String flowGroup = 
flowConfig.getString(ConfigurationKeys.FLOW_GROUP_KEY);
       String flowName = flowConfig.getString(ConfigurationKeys.FLOW_NAME_KEY);
 
-      DagActionStore.DagAction dagAction = 
DagActionStore.DagAction.forFlow(flowGroup, flowName,
-          FlowUtils.getOrCreateFlowExecutionId(flowSpec), 
DagActionStore.DagActionType.LAUNCH);
-      DagActionStore.LeaseParams leaseParams = new 
DagActionStore.LeaseParams(dagAction, System.currentTimeMillis());
-      _log.info("validation of lease acquirability of adhoc flow with lease 
params: " + leaseParams);
+      _log.info("checking existing adhoc flow existence for " + flowGroup + 
"." + flowName);
       try {
-        if (!dagManagementStateStore.isLeaseAcquirable(leaseParams)) {
-          throw new LeaseUnavailableException("Lease already occupied by 
another execution of this flow");
+        if 
(dagManagementStateStore.existsCurrentlyLaunchingSimilarFlow(flowGroup, 
flowName, FlowUtils.getOrCreateFlowExecutionId(flowSpec))) {
+          throw new TooSoonToRerunSameFlowException("Lease already occupied by 
another execution of this flow", flowSpec);

Review Comment:
   Updated, Thanks for the suggestion



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