ruanwenjun commented on code in PR #18082:
URL: 
https://github.com/apache/dolphinscheduler/pull/18082#discussion_r2965926025


##########
dolphinscheduler-master/pom.xml:
##########
@@ -307,6 +307,10 @@
                     <groupId>org.apache.logging.log4j</groupId>
                     <artifactId>log4j-to-slf4j</artifactId>
                 </exclusion>
+                <exclusion>
+                    <groupId>com.vaadin.external.google</groupId>
+                    <artifactId>android-json</artifactId>
+                </exclusion>

Review Comment:
   Why change this?



##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/serial/AbstractSerialCommandHandler.java:
##########
@@ -86,6 +87,13 @@ public Void doInTransaction(TransactionStatus status) {
                 workflowInstance.setEndTime(DateUtils.getCurrentDate());
                 workflowInstance.setState(WorkflowExecutionStatus.STOP);
                 workflowInstanceDao.upsertWorkflowInstance(workflowInstance);
+                final Long workflowDefinitionCode =
+                        serialCommand.getWorkflowDefinitionCode() != null
+                                ? serialCommand.getWorkflowDefinitionCode()
+                                : workflowInstance.getWorkflowDefinitionCode();
+                WorkflowInstanceMetrics.recordWorkflowInstanceFinish(
+                        WorkflowExecutionStatus.STOP,
+                        workflowDefinitionCode);

Review Comment:
   ```suggestion
                   WorkflowInstanceMetrics.recordWorkflowInstanceFinish(
                           WorkflowExecutionStatus.STOP,
                           workflowInstance.getWorkflowDefinitionCode());
   ```



##########
dolphinscheduler-master/src/test/resources/it/metrics/workflow_with_serial_discard_strategy_for_metrics.yaml:
##########
@@ -0,0 +1,61 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+project:
+  name: MasterIntegrationTest
+  code: 2102
+  description: This is a fake project
+  userId: 1
+  userName: admin
+  createTime: 2024-08-12 00:00:00
+  updateTime: 2021-08-12 00:00:00
+
+workflows:
+  - name: workflow_with_serial_discard_strategy_for_metrics
+    code: 210201
+    version: 1
+    projectCode: 2102
+    description: This is a fake workflow with single task for metrics
+    releaseState: ONLINE
+    createTime: 2024-08-12 00:00:00
+    updateTime: 2021-08-12 00:00:00
+    userId: 1
+    executionType: SERIAL_DISCARD
+
+tasks:
+  - name: A
+    code: 2102001
+    version: 1
+    projectCode: 2102
+    userId: 1
+    taskType: LogicFakeTask
+    taskParams: '{"localParams":null,"varPool":[],"shellScript":"sleep 5"}'

Review Comment:
   ```suggestion
       taskParams: '{"localParams":null,"varPool":[],"shellScript":"sleep 15"}'
   ```
   
   Since the serial coordinator loop interval is 5s, so we need to make sure 
the task can running longer than 5s, other the discard stragy might not effect.



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