This is an automated email from the ASF dual-hosted git repository.

wlo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/gobblin.git


The following commit(s) were added to refs/heads/master by this push:
     new 054279466b [GOBBLIN-2129] avoid throwing unnessary exception that is 
polluting logs (#4023)
054279466b is described below

commit 054279466b2f89e97d65c04599af749440b19c84
Author: Arjun Singh Bora <[email protected]>
AuthorDate: Mon Aug 12 12:24:46 2024 -0700

    [GOBBLIN-2129] avoid throwing unnessary exception that is polluting logs 
(#4023)
---
 .../modules/scheduler/GobblinServiceJobScheduler.java      | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git 
a/gobblin-service/src/main/java/org/apache/gobblin/service/modules/scheduler/GobblinServiceJobScheduler.java
 
b/gobblin-service/src/main/java/org/apache/gobblin/service/modules/scheduler/GobblinServiceJobScheduler.java
index afe8916130..3b2b4f0bfb 100644
--- 
a/gobblin-service/src/main/java/org/apache/gobblin/service/modules/scheduler/GobblinServiceJobScheduler.java
+++ 
b/gobblin-service/src/main/java/org/apache/gobblin/service/modules/scheduler/GobblinServiceJobScheduler.java
@@ -115,6 +115,7 @@ public class GobblinServiceJobScheduler extends 
JobScheduler implements SpecCata
   protected final Boolean isWarmStandbyEnabled;
   protected final Optional<UserQuotaManager> quotaManager;
   protected final Optional<FlowLaunchHandler> flowTriggerHandler;
+  // todo - consider using JobScheduler::scheduledJobs in place of 
scheduledFlowSpecs
   @Getter
   protected final Map<String, FlowSpec> scheduledFlowSpecs;
   @Getter
@@ -617,7 +618,7 @@ public class GobblinServiceJobScheduler extends 
JobScheduler implements SpecCata
    * @param specURI
    * @param specVersion
    */
-  private void unscheduleSpec(URI specURI, String specVersion) throws 
JobException {
+  private boolean unscheduleSpec(URI specURI, String specVersion) throws 
JobException {
     if (this.scheduledFlowSpecs.containsKey(specURI.toString())) {
       _log.info("Unscheduling flowSpec " + specURI + "/" + specVersion);
       this.scheduledFlowSpecs.remove(specURI.toString());
@@ -630,10 +631,12 @@ public class GobblinServiceJobScheduler extends 
JobScheduler implements SpecCata
         } catch (SpecNotFoundException e) {
           _log.warn("Unable to retrieve spec for URI {}", specURI);
         }
+      return true;
     } else {
-      throw new JobException(String.format(
-          "Spec with URI: %s was not found in cache. May be it was cleaned, if 
not please clean it manually",
+      _log.info(String.format(
+          "Spec with URI: %s was not found in cache. Maybe it was cleaned, if 
not please clean it manually",
           specURI));
+      return false;
     }
   }
 
@@ -659,8 +662,9 @@ public class GobblinServiceJobScheduler extends 
JobScheduler implements SpecCata
 
     try {
       Spec deletedSpec = 
this.scheduledFlowSpecs.get(deletedSpecURI.toString());
-      unscheduleSpec(deletedSpecURI, deletedSpecVersion);
-      this.orchestrator.remove(deletedSpec, headers);
+      if (unscheduleSpec(deletedSpecURI, deletedSpecVersion)) {
+        this.orchestrator.remove(deletedSpec, headers);
+      }
     } catch (JobException | IOException e) {
       _log.warn(String.format("Spec with URI: %s was not unscheduled 
cleaning", deletedSpecURI), e);
     }

Reply via email to