[ 
https://issues.apache.org/jira/browse/GOBBLIN-2142?focusedWorklogId=931652&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-931652
 ]

ASF GitHub Bot logged work on GOBBLIN-2142:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 26/Aug/24 05:46
            Start Date: 26/Aug/24 05:46
    Worklog Time Spent: 10m 
      Work Description: phet commented on code in PR #4037:
URL: https://github.com/apache/gobblin/pull/4037#discussion_r1730689967


##########
gobblin-service/src/test/java/org/apache/gobblin/service/modules/orchestration/DagManagerUtilsTest.java:
##########
@@ -38,4 +59,299 @@ public void testGetJobSpecFromDag() throws Exception {
       Assert.assertEquals(jobSpec.getConfigAsProperties().get(key), 
jobSpec.getConfig().getString(key));
     }
   }
+
+  @Test
+  public void testIsDagFinished() throws URISyntaxException {
+    long flowExecutionId = 12345L;
+    String flowGroup = "fg";
+    String flowName = "fn";
+
+    Dag<JobExecutionPlan> dag = DagManagerTest.buildDag("1", flowExecutionId, 
DagManager.FailureOption.FINISH_ALL_POSSIBLE.name(),
+        1, "user5", ConfigFactory.empty()
+            .withValue(ConfigurationKeys.FLOW_GROUP_KEY, 
ConfigValueFactory.fromAnyRef(flowGroup))
+            .withValue(ConfigurationKeys.FLOW_NAME_KEY, 
ConfigValueFactory.fromAnyRef(flowName))
+            .withValue(ConfigurationKeys.JOB_GROUP_KEY, 
ConfigValueFactory.fromAnyRef(flowGroup))
+            .withValue(ConfigurationKeys.SPECEXECUTOR_INSTANCE_URI_KEY, 
ConfigValueFactory.fromAnyRef(
+                MySqlDagManagementStateStoreTest.TEST_SPEC_EXECUTOR_URI))
+    );
+
+    setJobStatuses(dag, Collections.singletonList(COMPLETE));
+    Assert.assertTrue(DagProcUtils.isDagFinished(dag));
+
+    setJobStatuses(dag, Collections.singletonList(FAILED));
+    Assert.assertTrue(DagProcUtils.isDagFinished(dag));
+
+    setJobStatuses(dag, Collections.singletonList(CANCELLED));
+    Assert.assertTrue(DagProcUtils.isDagFinished(dag));
+
+    setJobStatuses(dag, Collections.singletonList(PENDING));
+    Assert.assertFalse(DagProcUtils.isDagFinished(dag));
+
+    setJobStatuses(dag, Collections.singletonList(PENDING_RETRY));
+    Assert.assertFalse(DagProcUtils.isDagFinished(dag));
+
+    setJobStatuses(dag, Collections.singletonList(PENDING_RESUME));
+    Assert.assertFalse(DagProcUtils.isDagFinished(dag));
+
+    setJobStatuses(dag, Collections.singletonList(RUNNING));
+    Assert.assertFalse(DagProcUtils.isDagFinished(dag));
+
+    dag = DagManagerTest.buildDag("1", flowExecutionId, 
DagManager.FailureOption.FINISH_ALL_POSSIBLE.name(),

Review Comment:
   rather than one single massive test method, could this be the start of a 
second test (e.g. single hop vs. multi)?
   
   (update: same advice goes for each of the several other re-assignments to 
`dag` that follow)





Issue Time Tracking
-------------------

    Worklog Id:     (was: 931652)
    Time Spent: 1h  (was: 50m)

> find if the dag is running or not correctly
> -------------------------------------------
>
>                 Key: GOBBLIN-2142
>                 URL: https://issues.apache.org/jira/browse/GOBBLIN-2142
>             Project: Apache Gobblin
>          Issue Type: Bug
>            Reporter: Arjun Singh Bora
>            Priority: Major
>          Time Spent: 1h
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to