You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "Jackie-Jiang (via GitHub)" <gi...@apache.org> on 2023/06/22 02:50:06 UTC

[GitHub] [pinot] Jackie-Jiang commented on a diff in pull request #10948: Batch null check

Jackie-Jiang commented on code in PR #10948:
URL: https://github.com/apache/pinot/pull/10948#discussion_r1237932213


##########
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:
   This abstraction doesn't seem clean to me (it is not really a job runner). Can we move the pre-condition check into the getters in `ExecutionFrameworkSpec`? Or we can add checked getters such as `getSegmentGenerationJobRunnerClassNameNotNull()`



-- 
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-unsubscribe@pinot.apache.org

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


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