mneedham commented on code in PR #10948:
URL: https://github.com/apache/pinot/pull/10948#discussion_r1238405901


##########
pinot-spi/src/main/java/org/apache/pinot/spi/ingestion/batch/IngestionJobLauncher.java:
##########
@@ -136,23 +137,33 @@ public static void 
runIngestionJob(SegmentGenerationJobSpec spec) {
     }
   }
 
-  private static void kickoffIngestionJob(SegmentGenerationJobSpec spec, 
String ingestionJobRunnerClassName) {
-    LOGGER.info("Trying to create instance for class {}", 
ingestionJobRunnerClassName);
+  private static void kickoffIngestionJob(SegmentGenerationJobSpec spec, 
JobRunner jobRunner) {
+    String jobRunnerClassName = jobRunner.getClassName();
+    LOGGER.info("Trying to create instance for class {}", jobRunnerClassName);
     IngestionJobRunner ingestionJobRunner;
     try {
-      ingestionJobRunner = 
PluginManager.get().createInstance(ingestionJobRunnerClassName);
+      Preconditions.checkState(
+              jobRunnerClassName != null,
+              jobRunner.getPropertyName() + " in job spec was null"
+      );
+      ingestionJobRunner = 
PluginManager.get().createInstance(jobRunnerClassName);
     } catch (Exception e) {
       throw new RuntimeException(
-          "Failed to create IngestionJobRunner instance for class - " + 
ingestionJobRunnerClassName, e);
+              "Failed to create IngestionJobRunner instance for class - " + 
jobRunnerClassName, e);
     }
     ingestionJobRunner.init(spec);
     try {
       ingestionJobRunner.run();
     } catch (Exception e) {
-      throw new RuntimeException("Caught exception during running - " + 
ingestionJobRunnerClassName, e);
+      throw new RuntimeException("Caught exception during running - " + 
jobRunnerClassName, e);
     }
   }
 
+  public interface JobRunner {

Review Comment:
   Oh yeh, that's a way better idea! I've updated it to use the `NotNull` 
suffix.



-- 
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.

To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to