[ https://issues.apache.org/jira/browse/GOBBLIN-746?focusedWorklogId=232312&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-232312 ]
ASF GitHub Bot logged work on GOBBLIN-746: ------------------------------------------ Author: ASF GitHub Bot Created on: 24/Apr/19 18:40 Start Date: 24/Apr/19 18:40 Worklog Time Spent: 10m Work Description: autumnust commented on pull request #2611: [GOBBLIN-746] Async loading FlowSpec URL: https://github.com/apache/incubator-gobblin/pull/2611#discussion_r278265423 ########## 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: Correct it is mostly for testing purpose. I was thinking `CountDownLatch` might be the right way to test asynchronous service start. Thanks for point this out. ---------------------------------------------------------------- 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: 232312) Time Spent: 1h 10m (was: 1h) > 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: 1h 10m > Remaining Estimate: 0h > -- This message was sent by Atlassian JIRA (v7.6.3#76005)