sv2000 commented on a change in pull request #2706: Emit WorkUnitsCreated Count Event for MR deployed jobs. URL: https://github.com/apache/incubator-gobblin/pull/2706#discussion_r313987352
########## File path: gobblin-runtime/src/main/java/org/apache/gobblin/runtime/local/LocalJobLauncher.java ########## @@ -130,20 +134,30 @@ protected void runWorkUnitStream(WorkUnitStream workUnitStream) throws Exception Iterator<WorkUnit> workUnitIterator = workUnitStream.getWorkUnits(); if (!workUnitIterator.hasNext()) { LOG.warn("No work units to run"); + CountEventBuilder countEventBuilder = new CountEventBuilder(JobEvent.WORK_UNITS_EMPTY, 0); + this.eventSubmitter.submit(countEventBuilder); return; } + this.workUnitCount = 0; + while (workUnitIterator.hasNext()) { Review comment: Can you replace the while loop with a for loop? e.g. for (i=workUnitIerator; i.next();) {...} Further the 2 countEventBuilders can be combined into a single statement at the end of the for loop: e.g. CountEventBuilder countEventBuilder = (workUnitCount=0)? new CountEventBuilder(JobEvent.WORK_UNITS_EMPTY, 0) : new CountEventBuilder(JobEvent.WORK_UNITS_CREATED, this.workUnitCount); ---------------------------------------------------------------- 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 With regards, Apache Git Services