This is an automated email from the ASF dual-hosted git repository.

zihaoxiang pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new 295570848d [Improvement-18056] Remove unused code in yarn aop module 
(#18117)
295570848d is described below

commit 295570848d0192502819aad5a1b4df56a5408c78
Author: xiangzihao <[email protected]>
AuthorDate: Wed Apr 1 18:27:01 2026 +0800

    [Improvement-18056] Remove unused code in yarn aop module (#18117)
---
 .../dolphinscheduler/aop/YarnClientAspect.java     | 28 ++++++++++------------
 .../dolphinscheduler/YarnClientAspectMocTest.java  |  2 +-
 2 files changed, 13 insertions(+), 17 deletions(-)

diff --git 
a/dolphinscheduler-yarn-aop/src/main/java/org/apache/dolphinscheduler/aop/YarnClientAspect.java
 
b/dolphinscheduler-yarn-aop/src/main/java/org/apache/dolphinscheduler/aop/YarnClientAspect.java
index 0b9375a36d..9e15053584 100644
--- 
a/dolphinscheduler-yarn-aop/src/main/java/org/apache/dolphinscheduler/aop/YarnClientAspect.java
+++ 
b/dolphinscheduler-yarn-aop/src/main/java/org/apache/dolphinscheduler/aop/YarnClientAspect.java
@@ -53,23 +53,20 @@ public class YarnClientAspect {
      *
      * @param appContext     application context when invoking 
YarnClientImpl.submitApplication
      * @param submittedAppId the submitted application id returned by 
YarnClientImpl.submitApplication
-     * @throws Throwable exceptions
      */
     @AfterReturning(pointcut = "execution(ApplicationId 
org.apache.hadoop.yarn.client.api.impl.YarnClientImpl." +
             "submitApplication(ApplicationSubmissionContext)) && 
args(appContext)", returning = "submittedAppId", argNames = 
"appContext,submittedAppId")
     public void registerApplicationInfo(ApplicationSubmissionContext 
appContext, ApplicationId submittedAppId) {
-        if (appInfoFilePath != null) {
-            try {
-                Files.write(Paths.get(appInfoFilePath),
-                        Collections.singletonList(submittedAppId.toString()),
-                        StandardOpenOption.CREATE,
-                        StandardOpenOption.WRITE,
-                        StandardOpenOption.APPEND);
-            } catch (IOException ioException) {
-                logger.error(
-                        "YarnClientAspect[registerAppInfo]: can't output 
current application information, because {}",
-                        ioException.getMessage());
-            }
+        try {
+            Files.write(Paths.get(appInfoFilePath),
+                    Collections.singletonList(submittedAppId.toString()),
+                    StandardOpenOption.CREATE,
+                    StandardOpenOption.WRITE,
+                    StandardOpenOption.APPEND);
+        } catch (IOException ioException) {
+            logger.error(
+                    "YarnClientAspect[registerAppInfo]: can't output current 
application information, because {}",
+                    ioException.getMessage());
         }
         logger.info("YarnClientAspect[submitApplication]: current application 
context {}", appContext);
         logger.info("YarnClientAspect[submitApplication]: submitted 
application id {}", submittedAppId);
@@ -82,12 +79,11 @@ public class YarnClientAspect {
      * This method will invoke many times, however, the last ApplicationReport 
instance assigned to currentApplicationReport
      *
      * @param appReport current application report when invoking 
getApplicationReport within submitApplication
-     * @param appId     current application id, which is the parameter of 
getApplicationReport
      */
     @AfterReturning(pointcut = "cflow(execution(ApplicationId 
org.apache.hadoop.yarn.client.api.impl.YarnClientImpl.submitApplication(ApplicationSubmissionContext)))
 "
             +
-            "&& !within(YarnClientAspect) && execution(ApplicationReport 
org.apache.hadoop.yarn.client.api.impl.YarnClientImpl.getApplicationReport(ApplicationId))
 && args(appId)", returning = "appReport", argNames = "appReport,appId")
-    public void registerApplicationReport(ApplicationReport appReport, 
ApplicationId appId) {
+            "&& !within(YarnClientAspect) && execution(ApplicationReport 
org.apache.hadoop.yarn.client.api.impl.YarnClientImpl.getApplicationReport(ApplicationId))",
 returning = "appReport", argNames = "appReport")
+    public void registerApplicationReport(ApplicationReport appReport) {
         currentApplicationReport = appReport;
     }
 }
diff --git 
a/dolphinscheduler-yarn-aop/src/test/java/org/apache/dolphinscheduler/YarnClientAspectMocTest.java
 
b/dolphinscheduler-yarn-aop/src/test/java/org/apache/dolphinscheduler/YarnClientAspectMocTest.java
index 165046e282..da73c250a5 100644
--- 
a/dolphinscheduler-yarn-aop/src/test/java/org/apache/dolphinscheduler/YarnClientAspectMocTest.java
+++ 
b/dolphinscheduler-yarn-aop/src/test/java/org/apache/dolphinscheduler/YarnClientAspectMocTest.java
@@ -64,7 +64,7 @@ class YarnClientAspectMocTest {
                     false, 10, null,
                     "type");
             moc.createAppId();
-            ApplicationId applicationId = moc.submitApplication(appContext);
+            moc.submitApplication(appContext);
             String stdoutContent = stdoutStream.toString();
             
Assertions.assertTrue(stdoutContent.contains("YarnClientAspectMoc[submitApplication]"),
                     "trigger YarnClientAspectMoc.submitApplication failed");

Reply via email to