[ 
https://issues.apache.org/jira/browse/GOBBLIN-746?focusedWorklogId=231787&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-231787
 ]

ASF GitHub Bot logged work on GOBBLIN-746:
------------------------------------------

                Author: ASF GitHub Bot
            Created on: 24/Apr/19 00:22
            Start Date: 24/Apr/19 00:22
    Worklog Time Spent: 10m 
      Work Description: sv2000 commented on pull request #2611: [GOBBLIN-746] 
Async loading FlowSpec
URL: https://github.com/apache/incubator-gobblin/pull/2611#discussion_r277917952
 
 

 ##########
 File path: 
gobblin-service/src/main/java/org/apache/gobblin/service/modules/scheduler/GobblinServiceJobScheduler.java
 ##########
 @@ -136,6 +136,46 @@ public synchronized void setActive(boolean isActive) {
     }
   }
 
+  /**
+   * Load all {@link FlowSpec}s from {@link FlowCatalog} as one of the 
initialization step,
+   * and make schedulers be aware of that.
+   *
+   */
+  private void scheduleSpecsFromCatalog() {
+    Iterator<URI> specUris = null;
+    long startTime = System.currentTimeMillis();
+
+    try {
+      specUris = this.flowCatalog.get().getSpecURIs();
+    } catch (SpecSerDeException ssde) {
+      throw new RuntimeException("Failed to get the iterator of all Spec 
URIS", ssde);
+    }
+
+
+    try {
+      while (specUris.hasNext()) {
+        Spec spec = null;
+        try {
+          spec = this.flowCatalog.get().getSpec(specUris.next());
+        } catch (SpecNotFoundException snfe) {
+          _log.error(String.format("The URI %s discovered in SpecStore is 
missing in FlowCatlog"
+              + ", suspecting current modification on SpecStore", 
specUris.next()), snfe);
+        }
+
+        //Disable FLOW_RUN_IMMEDIATELY on service startup or leadership change
+        if (spec instanceof FlowSpec) {
+          Spec modifiedSpec = disableFlowRunImmediatelyOnStart((FlowSpec) 
spec);
+          onAddSpec(modifiedSpec);
+        } else {
+          onAddSpec(spec);
+        }
+      }
+    } finally {
+      flowSpecInitFinished.countDown();
 
 Review comment:
   Is this countdown latch being used only in the test case? Your test case is 
waiting for at most 2 secs anyway. Can you simply do an AssertWithBackoff in 
your test case?
 
----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 231787)
    Time Spent: 0.5h  (was: 20m)

> Loading FlowSpecs asynchronously while initializing GobblinServiceManager
> -------------------------------------------------------------------------
>
>                 Key: GOBBLIN-746
>                 URL: https://issues.apache.org/jira/browse/GOBBLIN-746
>             Project: Apache Gobblin
>          Issue Type: Improvement
>            Reporter: Lei Sun
>            Priority: Major
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to