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

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

                Author: ASF GitHub Bot
            Created on: 10/Jan/24 21:18
            Start Date: 10/Jan/24 21:18
    Worklog Time Spent: 10m 
      Work Description: phet commented on code in PR #3853:
URL: https://github.com/apache/gobblin/pull/3853#discussion_r1447971860


##########
gobblin-service/src/main/java/org/apache/gobblin/service/modules/orchestration/DagManager.java:
##########
@@ -655,15 +655,15 @@ private void beginResumingDag(DagId dagIdToResume) throws 
IOException {
      */
     private void finishResumingDags() throws IOException {
       for (Map.Entry<String, Dag<JobExecutionPlan>> dag : 
this.resumingDags.entrySet()) {
-        JobStatus flowStatus = DagManagerUtils.pollFlowStatus(dag.getValue(), 
this.jobStatusRetriever, this.jobStatusPolledTimer);
-        if (flowStatus == null || 
!flowStatus.getEventName().equals(PENDING_RESUME.name())) {
+        Optional<JobStatus> flowStatus = 
DagManagerUtils.pollFlowStatus(dag.getValue(), this.jobStatusRetriever, 
this.jobStatusPolledTimer);
+        if (!flowStatus.isPresent() || 
!flowStatus.get().getEventName().equals(PENDING_RESUME.name())) {

Review Comment:
   how about
   ```
   if (!flowStatus.filter(fs -> 
fs.getEventName().equals(PENDING_RESUME.name())))
   ```
   ?



##########
gobblin-service/src/main/java/org/apache/gobblin/service/modules/orchestration/DagManagerUtils.java:
##########
@@ -433,17 +431,17 @@ public static  JobStatus 
pollFlowStatus(Dag<JobExecutionPlan> dag, JobStatusRetr
   /**

Review Comment:
   nit: document that `Optional.absent()` indicates job not found (e.g. rather 
than throwing)



##########
gobblin-service/src/main/java/org/apache/gobblin/service/modules/orchestration/DagManager.java:
##########
@@ -655,15 +655,15 @@ private void beginResumingDag(DagId dagIdToResume) throws 
IOException {
      */
     private void finishResumingDags() throws IOException {
       for (Map.Entry<String, Dag<JobExecutionPlan>> dag : 
this.resumingDags.entrySet()) {
-        JobStatus flowStatus = DagManagerUtils.pollFlowStatus(dag.getValue(), 
this.jobStatusRetriever, this.jobStatusPolledTimer);
-        if (flowStatus == null || 
!flowStatus.getEventName().equals(PENDING_RESUME.name())) {
+        Optional<JobStatus> flowStatus = 
DagManagerUtils.pollFlowStatus(dag.getValue(), this.jobStatusRetriever, 
this.jobStatusPolledTimer);
+        if (!flowStatus.isPresent() || 
!flowStatus.get().getEventName().equals(PENDING_RESUME.name())) {
           continue;
         }
 
         boolean dagReady = true;
         for (DagNode<JobExecutionPlan> node : dag.getValue().getNodes()) {
-          JobStatus jobStatus = DagManagerUtils.pollJobStatus(node, 
this.jobStatusRetriever, this.jobStatusPolledTimer);
-          if (jobStatus == null || 
jobStatus.getEventName().equals(FAILED.name()) || 
jobStatus.getEventName().equals(CANCELLED.name())) {
+          Optional<JobStatus> jobStatus = DagManagerUtils.pollJobStatus(node, 
this.jobStatusRetriever, this.jobStatusPolledTimer);
+          if (!jobStatus.isPresent() || 
jobStatus.get().getEventName().equals(FAILED.name()) || 
jobStatus.get().getEventName().equals(CANCELLED.name())) {

Review Comment:
   (similar here... and below)





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

    Worklog Id:     (was: 899055)
    Time Spent: 17h 10m  (was: 17h)

> Refactor code to move current in-memory references to new design for REST 
> calls: Launch, Resume and Kill
> --------------------------------------------------------------------------------------------------------
>
>                 Key: GOBBLIN-1910
>                 URL: https://issues.apache.org/jira/browse/GOBBLIN-1910
>             Project: Apache Gobblin
>          Issue Type: New Feature
>            Reporter: Meeth Gala
>            Priority: Major
>          Time Spent: 17h 10m
>  Remaining Estimate: 0h
>




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

Reply via email to