Source:
<code>public byte[] call(final byte[] memento) throws Exception { LOG.log(Level.INFO, "{0} starting from epoch {1}", new Object[]{taskId, startingEpoch}); final List<V> testData = testDataProvider.getTestData(); LOG.log(Level.INFO, "Test data set size: {0}", testData.size()); trainer.initGlobalSettings(); <START> workerGlobalBarrier.reset(); <END> workerGlobalBarrier.await(); for (int epochIdx = startingEpoch; epochIdx < maxNumEpochs; ++epochIdx) { LOG.log(Level.INFO, "Starting epoch {0}", epochIdx); progressReporter.report(epochIdx); final long epochStartTime = System.currentTimeMillis(); final PerOpTimeInEpoch perOpTimeInEpoch = new PerOpTimeInEpoch(); trainingDataProvider.prepareDataForEpoch(); final Collection<V> epochData = new LinkedList<>(); int miniBatchIdx = 0; while (true) { final Collection<V> miniBatchData = trainingDataProvider.getNextBatchData(); if (miniBatchData.isEmpty()) { break; } LOG.log(Level.INFO, "Starting batch {0} in epoch {1}", new Object[] {miniBatchIdx, epochIdx}); modelAccessor.getAndResetMetrics(); final long miniBatchStartTime = System.currentTimeMillis(); trainer.runMiniBatch(miniBatchData); final double miniBatchElapsedTime = (System.currentTimeMillis() - miniBatchStartTime) / 1000.0D; sendMiniBatchMetricsAndUpdateEpochOpTime(perOpTimeInEpoch, epochIdx, miniBatchIdx, miniBatchData.size(), miniBatchElapsedTime); epochData.addAll(miniBatchData); miniBatchIdx++; if (abortFlag.get()) { LOG.log(Level.INFO, "The task is getting closed."); return null; } } final double epochElapsedTimeSec = (System.currentTimeMillis() - epochStartTime) / 1000.0D; final EpochResult epochResult = trainer.onEpochFinished(epochData, testData, epochIdx); sendEpochMetrics(epochResult, epochIdx, miniBatchIdx, epochData.size(), epochElapsedTimeSec, perOpTimeInEpoch); } workerGlobalBarrier.await(); trainer.cleanup(); return null; }</code><technical_language>weird, WorkerGlobalBarrier is initialized itself</technical_language>

Target:
public byte[] call(final byte[] memento) throws Exception { LOG.log(Level.INFO, "{0} starting from epoch {1}", new Object[]{taskId, startingEpoch}); final List<V> testData = testDataProvider.getTestData(); LOG.log(Level.INFO, "Test data set size: {0}", testData.size()); trainer.initGlobalSettings(); workerGlobalBarrier.init(); workerGlobalBarrier.await(); for (int epochIdx = startingEpoch; epochIdx < maxNumEpochs; ++epochIdx) { LOG.log(Level.INFO, "Starting epoch {0}", epochIdx); progressReporter.report(epochIdx); final long epochStartTime = System.currentTimeMillis(); final PerOpTimeInEpoch perOpTimeInEpoch = new PerOpTimeInEpoch(); trainingDataProvider.prepareDataForEpoch(); final Collection<V> epochData = new LinkedList<>(); int miniBatchIdx = 0; while (true) { final Collection<V> miniBatchData = trainingDataProvider.getNextBatchData(); if (miniBatchData.isEmpty()) { break; } LOG.log(Level.INFO, "Starting batch {0} in epoch {1}", new Object[] {miniBatchIdx, epochIdx}); modelAccessor.getAndResetMetrics(); final long miniBatchStartTime = System.currentTimeMillis(); trainer.runMiniBatch(miniBatchData); final double miniBatchElapsedTime = (System.currentTimeMillis() - miniBatchStartTime) / 1000.0D; sendMiniBatchMetricsAndUpdateEpochOpTime(perOpTimeInEpoch, epochIdx, miniBatchIdx, miniBatchData.size(), miniBatchElapsedTime); epochData.addAll(miniBatchData); miniBatchIdx++; if (abortFlag.get()) { LOG.log(Level.INFO, "The task is getting closed."); return null; } } final double epochElapsedTimeSec = (System.currentTimeMillis() - epochStartTime) / 1000.0D; final EpochResult epochResult = trainer.onEpochFinished(epochData, testData, epochIdx); sendEpochMetrics(epochResult, epochIdx, miniBatchIdx, epochData.size(), epochElapsedTimeSec, perOpTimeInEpoch); } workerGlobalBarrier.await(); trainer.cleanup(); return null; }