jerryshao commented on code in PR #7772:
URL: https://github.com/apache/gravitino/pull/7772#discussion_r2227328048


##########
core/src/main/java/org/apache/gravitino/job/JobManager.java:
##########
@@ -226,8 +267,243 @@ public JobEntity getJob(String metalake, String jobId) 
throws NoSuchJobException
         });
   }
 
+  @Override
+  public JobEntity runJob(String metalake, String jobTemplateName, Map<String, 
String> jobConf)
+      throws NoSuchJobTemplateException {
+    checkMetalake(NameIdentifierUtil.ofMetalake(metalake), entityStore);
+
+    // Check if the job template exists, will throw NoSuchJobTemplateException 
if it does not exist.
+    JobTemplateEntity jobTemplateEntity = getJobTemplate(metalake, 
jobTemplateName);
+
+    // Create staging directory.
+    // TODO(jerry). The job staging directory will be deleted using a 
background thread.
+    long jobId = idGenerator.nextId();
+    File jobStagingDir = new File(stagingDir, JobHandle.JOB_ID_PREFIX + jobId);
+    if (!jobStagingDir.mkdirs()) {
+      throw new RuntimeException(
+          String.format("Failed to create staging directory %s for job %s", 
jobStagingDir, jobId));
+    }
+
+    // Create a JobTemplate by replacing the template parameters with the 
jobConf values, and
+    // also downloading any necessary files from the URIs specified in the job 
template.
+    JobTemplate jobTemplate = createRuntimeJobTemplate(jobTemplateEntity, 
jobConf, jobStagingDir);
+
+    // Submit the job template to the job executor
+    String jobExecutionId;

Review Comment:
   The `jobExecutionId` is a job id returned by external job executor, which is 
unique to the external job executor (like Airflow). The `jobExecutionId` is 
used to get the status from job executor, whereas the `jobId` is a unique id in 
Gravitino.



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

Reply via email to