@Test(dependsOnMethods = "testPrepareTask") public void testRun() throws IOException { TaskResult taskResult = this.gobblinHelixTask.run(); System.out.println(taskResult.getInfo()); Assert.assertEquals(taskResult.getStatus(), TaskResult.Status.COMPLETED); File outputAvroFile = new File(this.taskOutputDir.toString(), TestHelper.REL_WRITER_FILE_PATH + File.separator + TestHelper.WRITER_FILE_NAME); Assert.assertTrue(outputAvroFile.exists()); Schema schema = new Schema.Parser().parse(TestHelper.SOURCE_SCHEMA); TestHelper.assertGenericRecords(outputAvroFile, schema); }
@Override public TaskResult run() { this.taskMetrics.helixTaskTotalRunning.incrementAndGet(); long startTime = System.currentTimeMillis(); log.info("Actual task {} started. [{} {}]", this.taskId, this.applicationName, this.instanceName); try (Closer closer = Closer.create()) { closer.register(MDC.putCloseable(ConfigurationKeys.JOB_NAME_KEY, this.jobName)); closer.register(MDC.putCloseable(ConfigurationKeys.JOB_KEY_KEY, this.jobKey)); this.task.run(); log.info("Actual task {} completed.", this.taskId); this.taskMetrics.helixTaskTotalCompleted.incrementAndGet(); return new TaskResult(TaskResult.Status.COMPLETED, ""); } catch (InterruptedException ie) { log.error("Interrupting task {}", this.taskId); Thread.currentThread().interrupt(); log.error("Actual task {} interrupted.", this.taskId); this.taskMetrics.helixTaskTotalFailed.incrementAndGet(); return new TaskResult(TaskResult.Status.CANCELED, ""); } catch (TaskCreationException te) { eventBus.post(createTaskCreationEvent("Task Execution")); log.error("Actual task {} failed in creation due to {}, will request new container to schedule it", this.taskId, te.getMessage()); this.taskMetrics.helixTaskTotalCancelled.incrementAndGet(); return new TaskResult(TaskResult.Status.FAILED, Throwables.getStackTraceAsString(te)); } catch (Throwable t) { log.error("Actual task {} failed due to {}", this.taskId, t.getMessage()); this.taskMetrics.helixTaskTotalCancelled.incrementAndGet(); return new TaskResult(TaskResult.Status.FAILED, Throwables.getStackTraceAsString(t)); } finally { this.taskMetrics.helixTaskTotalRunning.decrementAndGet(); this.taskMetrics.updateTimeForTaskExecution(startTime); } }
GobblinHelixTask implements Task { @Override public TaskResult run() { this.taskMetrics.helixTaskTotalRunning.incrementAndGet(); long startTime = System.currentTimeMillis(); log.info("Actual task {} started. [{} {}]", this.taskId, this.applicationName, this.instanceName); try (Closer closer = Closer.create()) { closer.register(MDC.putCloseable(ConfigurationKeys.JOB_NAME_KEY, this.jobName)); closer.register(MDC.putCloseable(ConfigurationKeys.JOB_KEY_KEY, this.jobKey)); this.task.run(); log.info("Actual task {} completed.", this.taskId); this.taskMetrics.helixTaskTotalCompleted.incrementAndGet(); return new TaskResult(TaskResult.Status.COMPLETED, ""); } catch (InterruptedException ie) { log.error("Interrupting task {}", this.taskId); Thread.currentThread().interrupt(); log.error("Actual task {} interrupted.", this.taskId); this.taskMetrics.helixTaskTotalFailed.incrementAndGet(); return new TaskResult(TaskResult.Status.CANCELED, ""); } catch (TaskCreationException te) { eventBus.post(createTaskCreationEvent("Task Execution")); log.error("Actual task {} failed in creation due to {}, will request new container to schedule it", this.taskId, te.getMessage()); this.taskMetrics.helixTaskTotalCancelled.incrementAndGet(); return new TaskResult(TaskResult.Status.FAILED, Throwables.getStackTraceAsString(te)); } catch (Throwable t) { log.error("Actual task {} failed due to {}", this.taskId, t.getMessage()); this.taskMetrics.helixTaskTotalCancelled.incrementAndGet(); return new TaskResult(TaskResult.Status.FAILED, Throwables.getStackTraceAsString(t)); } finally { this.taskMetrics.helixTaskTotalRunning.decrementAndGet(); this.taskMetrics.updateTimeForTaskExecution(startTime); } } }
GobblinHelixTask implements Task { @Override public TaskResult run() { this.taskMetrics.helixTaskTotalRunning.incrementAndGet(); long startTime = System.currentTimeMillis(); log.info("Actual task {} started. [{} {}]", this.taskId, this.applicationName, this.instanceName); try (Closer closer = Closer.create()) { closer.register(MDC.putCloseable(ConfigurationKeys.JOB_NAME_KEY, this.jobName)); closer.register(MDC.putCloseable(ConfigurationKeys.JOB_KEY_KEY, this.jobKey)); this.task.run(); log.info("Actual task {} completed.", this.taskId); this.taskMetrics.helixTaskTotalCompleted.incrementAndGet(); return new TaskResult(TaskResult.Status.COMPLETED, ""); } catch (InterruptedException ie) { log.error("Interrupting task {}", this.taskId); Thread.currentThread().interrupt(); log.error("Actual task {} interrupted.", this.taskId); this.taskMetrics.helixTaskTotalFailed.incrementAndGet(); return new TaskResult(TaskResult.Status.CANCELED, ""); } catch (TaskCreationException te) { eventBus.post(createTaskCreationEvent("Task Execution")); log.error("Actual task {} failed in creation due to {}, will request new container to schedule it", this.taskId, te.getMessage()); this.taskMetrics.helixTaskTotalCancelled.incrementAndGet(); return new TaskResult(TaskResult.Status.FAILED, Throwables.getStackTraceAsString(te)); } catch (Throwable t) { log.error("Actual task {} failed due to {}", this.taskId, t.getMessage()); this.taskMetrics.helixTaskTotalCancelled.incrementAndGet(); return new TaskResult(TaskResult.Status.FAILED, Throwables.getStackTraceAsString(t)); } finally { this.taskMetrics.helixTaskTotalRunning.decrementAndGet(); this.taskMetrics.updateTimeForTaskExecution(startTime); } } GobblinHelixTask(TaskRunnerSuiteBase.Builder builder,
                          TaskCallbackContext taskCallbackContext,
                          TaskAttemptBuilder taskAttemptBuilder,
                          StateStores stateStores,
                          GobblinHelixTaskMetrics taskMetrics,
                          TaskDriver taskDriver); }
GobblinHelixTask implements Task { @Override public TaskResult run() { this.taskMetrics.helixTaskTotalRunning.incrementAndGet(); long startTime = System.currentTimeMillis(); log.info("Actual task {} started. [{} {}]", this.taskId, this.applicationName, this.instanceName); try (Closer closer = Closer.create()) { closer.register(MDC.putCloseable(ConfigurationKeys.JOB_NAME_KEY, this.jobName)); closer.register(MDC.putCloseable(ConfigurationKeys.JOB_KEY_KEY, this.jobKey)); this.task.run(); log.info("Actual task {} completed.", this.taskId); this.taskMetrics.helixTaskTotalCompleted.incrementAndGet(); return new TaskResult(TaskResult.Status.COMPLETED, ""); } catch (InterruptedException ie) { log.error("Interrupting task {}", this.taskId); Thread.currentThread().interrupt(); log.error("Actual task {} interrupted.", this.taskId); this.taskMetrics.helixTaskTotalFailed.incrementAndGet(); return new TaskResult(TaskResult.Status.CANCELED, ""); } catch (TaskCreationException te) { eventBus.post(createTaskCreationEvent("Task Execution")); log.error("Actual task {} failed in creation due to {}, will request new container to schedule it", this.taskId, te.getMessage()); this.taskMetrics.helixTaskTotalCancelled.incrementAndGet(); return new TaskResult(TaskResult.Status.FAILED, Throwables.getStackTraceAsString(te)); } catch (Throwable t) { log.error("Actual task {} failed due to {}", this.taskId, t.getMessage()); this.taskMetrics.helixTaskTotalCancelled.incrementAndGet(); return new TaskResult(TaskResult.Status.FAILED, Throwables.getStackTraceAsString(t)); } finally { this.taskMetrics.helixTaskTotalRunning.decrementAndGet(); this.taskMetrics.updateTimeForTaskExecution(startTime); } } GobblinHelixTask(TaskRunnerSuiteBase.Builder builder,
                          TaskCallbackContext taskCallbackContext,
                          TaskAttemptBuilder taskAttemptBuilder,
                          StateStores stateStores,
                          GobblinHelixTaskMetrics taskMetrics,
                          TaskDriver taskDriver); @Override TaskResult run(); @Override void cancel(); }
GobblinHelixTask implements Task { @Override public TaskResult run() { this.taskMetrics.helixTaskTotalRunning.incrementAndGet(); long startTime = System.currentTimeMillis(); log.info("Actual task {} started. [{} {}]", this.taskId, this.applicationName, this.instanceName); try (Closer closer = Closer.create()) { closer.register(MDC.putCloseable(ConfigurationKeys.JOB_NAME_KEY, this.jobName)); closer.register(MDC.putCloseable(ConfigurationKeys.JOB_KEY_KEY, this.jobKey)); this.task.run(); log.info("Actual task {} completed.", this.taskId); this.taskMetrics.helixTaskTotalCompleted.incrementAndGet(); return new TaskResult(TaskResult.Status.COMPLETED, ""); } catch (InterruptedException ie) { log.error("Interrupting task {}", this.taskId); Thread.currentThread().interrupt(); log.error("Actual task {} interrupted.", this.taskId); this.taskMetrics.helixTaskTotalFailed.incrementAndGet(); return new TaskResult(TaskResult.Status.CANCELED, ""); } catch (TaskCreationException te) { eventBus.post(createTaskCreationEvent("Task Execution")); log.error("Actual task {} failed in creation due to {}, will request new container to schedule it", this.taskId, te.getMessage()); this.taskMetrics.helixTaskTotalCancelled.incrementAndGet(); return new TaskResult(TaskResult.Status.FAILED, Throwables.getStackTraceAsString(te)); } catch (Throwable t) { log.error("Actual task {} failed due to {}", this.taskId, t.getMessage()); this.taskMetrics.helixTaskTotalCancelled.incrementAndGet(); return new TaskResult(TaskResult.Status.FAILED, Throwables.getStackTraceAsString(t)); } finally { this.taskMetrics.helixTaskTotalRunning.decrementAndGet(); this.taskMetrics.updateTimeForTaskExecution(startTime); } } GobblinHelixTask(TaskRunnerSuiteBase.Builder builder,
                          TaskCallbackContext taskCallbackContext,
                          TaskAttemptBuilder taskAttemptBuilder,
                          StateStores stateStores,
                          GobblinHelixTaskMetrics taskMetrics,
                          TaskDriver taskDriver); @Override TaskResult run(); @Override void cancel();  }