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


##########
api/src/main/java/org/apache/gravitino/job/SupportsJobs.java:
##########
@@ -124,7 +124,23 @@ JobHandle runJob(String jobTemplateName, Map<String, 
String> jobConf)
    * @return a handle to the job
    * @throws NoSuchJobException if the job with the specified ID does not exist
    */
-  JobHandle getJob(String jobId) throws NoSuchJobException;
+  default JobHandle getJob(String jobId) throws NoSuchJobException {
+    return getJob(jobId, false);
+  }
+
+  /**
+   * Retrieves a job by its ID, optionally including its captured 
stdout/stderr output (see {@link
+   * JobHandle#stdout()}/{@link JobHandle#stderr()}).
+   *
+   * <p>Output is fetched live from the job executor on every call, not 
persisted, so {@code
+   * includeOutput} should only be set to {@code true} when the output is 
actually needed.
+   *
+   * @param jobId the ID of the job to retrieve
+   * @param includeOutput whether to also fetch and populate the job's 
stdout/stderr output
+   * @return a handle to the job
+   * @throws NoSuchJobException if the job with the specified ID does not exist
+   */
+  JobHandle getJob(String jobId, boolean includeOutput) throws 
NoSuchJobException;

Review Comment:
   One refinement on top of the fix above, per @jerryshao's feedback: the 
default `getJob(jobId, includeOutput=true)` now throws 
`UnsupportedOperationException` instead of silently delegating to 
`getJob(jobId)` and returning a handle with no output — an implementor that 
hasn't opted into output retrieval should say so explicitly rather than have 
the request quietly do nothing. `includeOutput=false` still delegates to 
`getJob(jobId)` since that's a genuine no-op. Added 
`api/.../TestSupportsJobs.java` with a minimal legacy-style implementor to lock 
in both the compatibility contract and this behavior.
   
   _🤖 Addressed by [Claude Code](https://claude.com/claude-code)_



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