churromorales commented on code in PR #13156:
URL: https://github.com/apache/druid/pull/13156#discussion_r1006252095


##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/AbstractTask.java:
##########
@@ -125,6 +134,49 @@ protected AbstractTask(
     this(id, groupId, taskResource, dataSource, context, IngestionMode.NONE);
   }
 
+  @Nullable
+  public String setup(TaskToolbox toolbox) throws Exception
+  {
+    File taskDir = toolbox.getConfig().getTaskDir(getId());
+    FileUtils.mkdirp(taskDir);
+    File attemptDir = Paths.get(taskDir.getAbsolutePath(), "attempt", 
toolbox.getAttemptId()).toFile();
+    FileUtils.mkdirp(attemptDir);
+    reportsFile = new File(attemptDir, "report.json");
+    log.debug("Task setup complete");
+    return null;
+  }
+
+  @Override
+  public final TaskStatus run(TaskToolbox taskToolbox) throws Exception
+  {
+    try {
+      String errorMessage = setup(taskToolbox);
+      if (org.apache.commons.lang3.StringUtils.isNotBlank(errorMessage)) {

Review Comment:
   it was how the original code was handling it.  I tried to minimize changes 
to core, ideally a message would not determine whether to throw an exception or 
not.  Let me know if you have strong feelings here. 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to