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

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

                Author: ASF GitHub Bot
            Created on: 26/May/22 01:32
            Start Date: 26/May/22 01:32
    Worklog Time Spent: 10m 
      Work Description: umustafi commented on code in PR #3511:
URL: https://github.com/apache/gobblin/pull/3511#discussion_r882240868


##########
gobblin-service/src/main/java/org/apache/gobblin/service/modules/orchestration/UserQuotaManager.java:
##########
@@ -102,11 +115,20 @@ public void checkQuota(Dag.DagNode<JobExecutionPlan> 
dagNode, boolean onInit) th
       }
     }
 
+    int flowGroupQuotaIncrement = incrementJobCountAndCheckQuota(
+        DagManagerUtils.getFlowGroupQuotaKey(flowGroup, dagNode), 
flowGroupToJobCount, dagNode, getQuotaForFlowGroup(flowGroup));
+    boolean flowGroupCheck = flowGroupQuotaIncrement >= 0;
+    if (!flowGroupCheck) {
+      requesterMessage.append(String.format(
+          "Quota exceeded for flowgroup %s on executor %s : quota=%s, requests 
above quota=%d%n",
+          flowGroup, specExecutorUri, getQuotaForFlowGroup(flowGroup), 
Math.abs(flowGroupQuotaIncrement)+1-getQuotaForFlowGroup(flowGroup)));
+    }
+
     // Throw errors for reach quota at the end to avoid inconsistent job counts
-    if ((!proxyUserCheck || !requesterCheck) && !onInit) {
+    if ((!proxyUserCheck || !requesterCheck || !flowGroupCheck) && !onInit) {
       // roll back the increased counts in this block
-      String userKey = DagManagerUtils.getUserQuotaKey(proxyUser, dagNode);
-      decrementQuotaUsage(proxyUserToJobCount, userKey);
+      decrementQuotaUsage(proxyUserToJobCount, 
DagManagerUtils.getUserQuotaKey(proxyUser, dagNode));

Review Comment:
   I see, we decrement only when the dag is actually removed to avoid using 
locks. We cannot check quota and increment/decrement without concurrency 
management. Does the concurrent hashmap not protect us from this?





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

    Worklog Id:     (was: 774873)
    Time Spent: 1h 40m  (was: 1.5h)

> Allow GaaS to enforce quotas by flowgroup
> -----------------------------------------
>
>                 Key: GOBBLIN-1650
>                 URL: https://issues.apache.org/jira/browse/GOBBLIN-1650
>             Project: Apache Gobblin
>          Issue Type: New Feature
>            Reporter: William Lo
>            Priority: Major
>          Time Spent: 1h 40m
>  Remaining Estimate: 0h
>
> Certain GaaS flows can have a large number of flows that can cause 
> instability on dependent services. We want to be able to control the 
> throughput of flows from a flowgroup granularity on top of a user 
> granularity. We keep the quota configuration separate as there can be many 
> users submitting flows to the same flowgroup.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to