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

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

                Author: ASF GitHub Bot
            Created on: 13/Jun/23 09:50
            Start Date: 13/Jun/23 09:50
    Worklog Time Spent: 10m 
      Work Description: phet commented on code in PR #3700:
URL: https://github.com/apache/gobblin/pull/3700#discussion_r1227765802


##########
gobblin-service/src/main/java/org/apache/gobblin/service/modules/orchestration/FlowTriggerHandler.java:
##########
@@ -96,82 +93,79 @@ public SchedulerLeaseAlgoHandler(Config config, 
MultiActiveLeaseArbiter leaseDet
    * @param eventTimeMillis
    * @throws IOException
    */
-  public void handleNewSchedulerEvent(Properties jobProps, 
DagActionStore.DagAction flowAction, long eventTimeMillis)
+  public void handleTriggerEvent(Properties jobProps, DagActionStore.DagAction 
flowAction, long eventTimeMillis)
       throws IOException {
-    LeaseAttemptStatus leaseAttemptStatus =
+    MultiActiveLeaseArbiter.LeaseAttemptStatus leaseAttemptStatus =
         multiActiveLeaseArbiter.tryAcquireLease(flowAction, eventTimeMillis);
     // TODO: add a log event or metric for each of these cases
-    switch (leaseAttemptStatus.getClass().getSimpleName()) {
-      case "LeaseObtainedStatus":
-        finalizeLease((LeaseObtainedStatus) leaseAttemptStatus, flowAction);
-        break;
-      case "LeasedToAnotherStatus":
-        scheduleReminderForEvent(jobProps, (LeasedToAnotherStatus) 
leaseAttemptStatus, flowAction, eventTimeMillis);
-        break;
-      case "NoLongerLeasingStatus":
-        break;
-      default:
+    if (leaseAttemptStatus instanceof 
MultiActiveLeaseArbiter.LeaseObtainedStatus) {
+      persistFlowAction((MultiActiveLeaseArbiter.LeaseObtainedStatus) 
leaseAttemptStatus, flowAction);
+      return;
+    } else if (leaseAttemptStatus instanceof 
MultiActiveLeaseArbiter.LeasedToAnotherStatus) {
+      scheduleReminderForEvent(jobProps, 
(MultiActiveLeaseArbiter.LeasedToAnotherStatus) leaseAttemptStatus, flowAction,
+          eventTimeMillis);
+    } else if (leaseAttemptStatus instanceof  
MultiActiveLeaseArbiter.NoLongerLeasingStatus) {
+      return;
     }
+    log.warn("Received type of leaseAttemptStatus: {} not handled by this 
method", leaseAttemptStatus.getClass().getName());

Review Comment:
   since this represents a gaping hole in our impl, it's actually more 
appropriate to scream/panic/freak out via `RuntimeException`, than it is to 
presume to continue (as if completely shirking all responsibility for the 
`flowAction`)



##########
gobblin-service/src/main/java/org/apache/gobblin/service/modules/orchestration/FlowTriggerHandler.java:
##########
@@ -96,82 +93,79 @@ public SchedulerLeaseAlgoHandler(Config config, 
MultiActiveLeaseArbiter leaseDet
    * @param eventTimeMillis
    * @throws IOException
    */
-  public void handleNewSchedulerEvent(Properties jobProps, 
DagActionStore.DagAction flowAction, long eventTimeMillis)
+  public void handleTriggerEvent(Properties jobProps, DagActionStore.DagAction 
flowAction, long eventTimeMillis)
       throws IOException {
-    LeaseAttemptStatus leaseAttemptStatus =
+    MultiActiveLeaseArbiter.LeaseAttemptStatus leaseAttemptStatus =
         multiActiveLeaseArbiter.tryAcquireLease(flowAction, eventTimeMillis);
     // TODO: add a log event or metric for each of these cases
-    switch (leaseAttemptStatus.getClass().getSimpleName()) {
-      case "LeaseObtainedStatus":
-        finalizeLease((LeaseObtainedStatus) leaseAttemptStatus, flowAction);
-        break;
-      case "LeasedToAnotherStatus":
-        scheduleReminderForEvent(jobProps, (LeasedToAnotherStatus) 
leaseAttemptStatus, flowAction, eventTimeMillis);
-        break;
-      case "NoLongerLeasingStatus":
-        break;
-      default:
+    if (leaseAttemptStatus instanceof 
MultiActiveLeaseArbiter.LeaseObtainedStatus) {
+      persistFlowAction((MultiActiveLeaseArbiter.LeaseObtainedStatus) 
leaseAttemptStatus, flowAction);
+      return;
+    } else if (leaseAttemptStatus instanceof 
MultiActiveLeaseArbiter.LeasedToAnotherStatus) {
+      scheduleReminderForEvent(jobProps, 
(MultiActiveLeaseArbiter.LeasedToAnotherStatus) leaseAttemptStatus, flowAction,
+          eventTimeMillis);
+    } else if (leaseAttemptStatus instanceof  
MultiActiveLeaseArbiter.NoLongerLeasingStatus) {
+      return;
     }
+    log.warn("Received type of leaseAttemptStatus: {} not handled by this 
method", leaseAttemptStatus.getClass().getName());

Review Comment:
   since this represents a gaping hole in our impl, it's actually more 
appropriate to scream/panic/freak out via `RuntimeException`, than to presume 
to continue (as if completely shirking all responsibility for the `flowAction`)





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

    Worklog Id:     (was: 865144)
    Time Spent: 13h 50m  (was: 13h 40m)

> Implement multi-active, non blocking for leader host
> ----------------------------------------------------
>
>                 Key: GOBBLIN-1837
>                 URL: https://issues.apache.org/jira/browse/GOBBLIN-1837
>             Project: Apache Gobblin
>          Issue Type: Bug
>          Components: gobblin-service
>            Reporter: Urmi Mustafi
>            Assignee: Abhishek Tiwari
>            Priority: Major
>          Time Spent: 13h 50m
>  Remaining Estimate: 0h
>
> This task will include the implementation of non-blocking, multi-active 
> scheduler for each host. It will NOT include metric emission or unit tests 
> for validation. That will be done in a separate follow-up ticket. The work in 
> this ticket includes
>  * define a table to do scheduler lease determination for each flow's trigger 
> event and related methods to execute actions on this tableĀ 
>  * update DagActionStore schema and DagActionStoreMonitor to act upon new 
> "LAUNCH" type events in addition to KILL/RESUME
>  * update scheduler/orchestrator logic to apply the non-blocking algorithm 
> when "multi-active scheduler mode" is enabled, otherwise submit events 
> directly to the DagManager after receiving a scheduler trigger
>  * implement the non-blocking algorithm, particularly handling reminder 
> events if another host is in the process of securing the lease for a 
> particular flow trigger



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

Reply via email to