yuqi1129 commented on code in PR #8707:
URL: https://github.com/apache/gravitino/pull/8707#discussion_r2386525645


##########
core/src/main/java/org/apache/gravitino/job/JobManager.java:
##########
@@ -300,6 +300,40 @@ public boolean deleteJobTemplate(String metalake, String 
jobTemplateName) throws
         });
   }
 
+  @Override
+  public JobTemplateEntity alterJobTemplate(
+      String metalake, String jobTemplateName, JobTemplateChange... changes)
+      throws NoSuchJobTemplateException, IllegalArgumentException {
+    checkMetalake(NameIdentifierUtil.ofMetalake(metalake), entityStore);
+
+    NameIdentifier jobTemplateIdent = 
NameIdentifierUtil.ofJobTemplate(metalake, jobTemplateName);
+    return TreeLockUtils.doWithTreeLock(
+        jobTemplateIdent,
+        LockType.WRITE,
+        () -> {
+          try {
+            return entityStore.update(
+                jobTemplateIdent,
+                JobTemplateEntity.class,
+                Entity.EntityType.JOB_TEMPLATE,
+                jobTemplateEntity ->
+                    updateJobTemplateEntity(jobTemplateIdent, 
jobTemplateEntity, changes));
+          } catch (NoSuchEntityException e) {
+            throw new NoSuchJobTemplateException(
+                "Job template with name %s under metalake %s does not exist",
+                jobTemplateName, metalake);
+          } catch (IOException ioe) {
+            throw new RuntimeException(ioe);
+          } catch (EntityAlreadyExistsException e) {
+            throw new RuntimeException(
+                "Job template with the same name "
+                    + jobTemplateName

Review Comment:
   And the message `because job template doesn't support rename` is quite 
misleading.



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