You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@gobblin.apache.org by GitBox <gi...@apache.org> on 2020/03/06 01:32:32 UTC

[GitHub] [incubator-gobblin] jack-moseley opened a new pull request #2913: [GOBBLIN-1073] Add proxy user and requester quota to GaaS

jack-moseley opened a new pull request #2913: [GOBBLIN-1073] Add proxy user and requester quota to GaaS
URL: https://github.com/apache/incubator-gobblin/pull/2913
 
 
   Dear Gobblin maintainers,
   
   Please accept this PR. I understand that it will not be reviewed until I have checked off all the steps below!
   
   
   ### JIRA
   - [x] My PR addresses the following [Gobblin JIRA](https://issues.apache.org/jira/browse/GOBBLIN/) issues and references them in the PR title. For example, "[GOBBLIN-XXX] My Gobblin PR"
       - https://issues.apache.org/jira/browse/GOBBLIN-1073
   
   
   ### Description
   - [x] Here are some details about my PR, including screenshots (if applicable):
   
   Add job-level quota to GaaS for both proxy users and service requesters. If a proxy user or requester goes above the quota, their jobs will be failed on submission. Users can be whitelisted to have unlimited quota.
   
   ### Tests
   - [x] My PR adds the following unit tests __OR__ does not need testing for this extremely good reason:
   
   
   ### Commits
   - [x] My commits all reference JIRA issues in their subject lines, and I have squashed multiple commits if they address the same issue. In addition, my commits follow the guidelines from "[How to write a good git commit message](http://chris.beams.io/posts/git-commit/)":
       1. Subject is separated from body by a blank line
       2. Subject is limited to 50 characters
       3. Subject does not end with a period
       4. Subject uses the imperative mood ("add", not "adding")
       5. Body wraps at 72 characters
       6. Body explains "what" and "why", not "how"
   
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-gobblin] jack-moseley commented on a change in pull request #2913: [GOBBLIN-1073] Add proxy user and requester quota to GaaS

Posted by GitBox <gi...@apache.org>.
jack-moseley commented on a change in pull request #2913: [GOBBLIN-1073] Add proxy user and requester quota to GaaS
URL: https://github.com/apache/incubator-gobblin/pull/2913#discussion_r391240148
 
 

 ##########
 File path: gobblin-service/src/main/java/org/apache/gobblin/service/modules/orchestration/DagManager.java
 ##########
 @@ -362,6 +370,8 @@ public synchronized void setActive(boolean active) {
    */
   public static class DagManagerThread implements Runnable {
     private final Map<DagNode<JobExecutionPlan>, Dag<JobExecutionPlan>> jobToDag = new HashMap<>();
+    private static final Map<String, Integer> proxyUserToJobCount = new ConcurrentHashMap<>();
 
 Review comment:
   It is a global map since I made it static right? Or are you saying it shouldn't be global?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-gobblin] asfgit closed pull request #2913: [GOBBLIN-1073] Add proxy user and requester quota to GaaS

Posted by GitBox <gi...@apache.org>.
asfgit closed pull request #2913: [GOBBLIN-1073] Add proxy user and requester quota to GaaS
URL: https://github.com/apache/incubator-gobblin/pull/2913
 
 
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-gobblin] sv2000 commented on a change in pull request #2913: [GOBBLIN-1073] Add proxy user and requester quota to GaaS

Posted by GitBox <gi...@apache.org>.
sv2000 commented on a change in pull request #2913: [GOBBLIN-1073] Add proxy user and requester quota to GaaS
URL: https://github.com/apache/incubator-gobblin/pull/2913#discussion_r391187414
 
 

 ##########
 File path: gobblin-service/src/main/java/org/apache/gobblin/service/modules/orchestration/DagManager.java
 ##########
 @@ -182,6 +188,8 @@ public DagManager(Config config, boolean instrumentationEnabled) {
     } else {
       this.eventSubmitter = Optional.absent();
     }
+    this.quota = ConfigUtils.getInt(config, USER_JOB_QUOTA_KEY, DEFAULT_USER_JOB_QUOTA);
 
 Review comment:
   Will we have one quota config for all users? Can we make it a per-user config?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-gobblin] sv2000 commented on a change in pull request #2913: [GOBBLIN-1073] Add proxy user and requester quota to GaaS

Posted by GitBox <gi...@apache.org>.
sv2000 commented on a change in pull request #2913: [GOBBLIN-1073] Add proxy user and requester quota to GaaS
URL: https://github.com/apache/incubator-gobblin/pull/2913#discussion_r391259230
 
 

 ##########
 File path: gobblin-service/src/main/java/org/apache/gobblin/service/modules/orchestration/DagManager.java
 ##########
 @@ -362,6 +370,8 @@ public synchronized void setActive(boolean active) {
    */
   public static class DagManagerThread implements Runnable {
     private final Map<DagNode<JobExecutionPlan>, Dag<JobExecutionPlan>> jobToDag = new HashMap<>();
+    private static final Map<String, Integer> proxyUserToJobCount = new ConcurrentHashMap<>();
 
 Review comment:
   I missed the static declaration. Thanks! I was expecting this map to be declared in DagManager and being passed to each of the threads. But this should work too. 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-gobblin] codecov-io commented on issue #2913: [GOBBLIN-1073] Add proxy user and requester quota to GaaS

Posted by GitBox <gi...@apache.org>.
codecov-io commented on issue #2913: [GOBBLIN-1073] Add proxy user and requester quota to GaaS
URL: https://github.com/apache/incubator-gobblin/pull/2913#issuecomment-597413059
 
 
   # [Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/2913?src=pr&el=h1) Report
   > Merging [#2913](https://codecov.io/gh/apache/incubator-gobblin/pull/2913?src=pr&el=desc) into [master](https://codecov.io/gh/apache/incubator-gobblin/commit/64f9339027e4cbaec320ae7849a4f47e2d71e1c9?src=pr&el=desc) will **increase** coverage by `0.01%`.
   > The diff coverage is `38.88%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/incubator-gobblin/pull/2913/graphs/tree.svg?width=650&token=4MgURJ0bGc&height=150&src=pr)](https://codecov.io/gh/apache/incubator-gobblin/pull/2913?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #2913      +/-   ##
   ============================================
   + Coverage     45.85%   45.86%   +0.01%     
   + Complexity     9187     9186       -1     
   ============================================
     Files          1934     1934              
     Lines         72858    72981     +123     
     Branches       8033     8057      +24     
   ============================================
   + Hits          33411    33476      +65     
   - Misses        36382    36428      +46     
   - Partials       3065     3077      +12
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-gobblin/pull/2913?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [...blin/service/modules/orchestration/DagManager.java](https://codecov.io/gh/apache/incubator-gobblin/pull/2913/diff?src=pr&el=tree#diff-Z29iYmxpbi1zZXJ2aWNlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL3NlcnZpY2UvbW9kdWxlcy9vcmNoZXN0cmF0aW9uL0RhZ01hbmFnZXIuamF2YQ==) | `72.01% <38.88%> (-4.46%)` | `13 <0> (ø)` | |
   | [...ache/gobblin/cluster/InMemorySingleTaskRunner.java](https://codecov.io/gh/apache/incubator-gobblin/pull/2913/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvSW5NZW1vcnlTaW5nbGVUYXNrUnVubmVyLmphdmE=) | `75% <0%> (-25%)` | `3% <0%> (ø)` | |
   | [.../org/apache/gobblin/metrics/RootMetricContext.java](https://codecov.io/gh/apache/incubator-gobblin/pull/2913/diff?src=pr&el=tree#diff-Z29iYmxpbi1tZXRyaWNzLWxpYnMvZ29iYmxpbi1tZXRyaWNzLWJhc2Uvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dvYmJsaW4vbWV0cmljcy9Sb290TWV0cmljQ29udGV4dC5qYXZh) | `78.12% <0%> (-1.57%)` | `15% <0%> (-1%)` | |
   | [.../org/apache/gobblin/cluster/GobblinTaskRunner.java](https://codecov.io/gh/apache/incubator-gobblin/pull/2913/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvR29iYmxpblRhc2tSdW5uZXIuamF2YQ==) | `64% <0%> (-1.07%)` | `26% <0%> (-3%)` | |
   | [.../apache/gobblin/cluster/GobblinClusterManager.java](https://codecov.io/gh/apache/incubator-gobblin/pull/2913/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvR29iYmxpbkNsdXN0ZXJNYW5hZ2VyLmphdmE=) | `53.91% <0%> (-1.04%)` | `26% <0%> (-2%)` | |
   | [...rg/apache/gobblin/yarn/GobblinYarnAppLauncher.java](https://codecov.io/gh/apache/incubator-gobblin/pull/2913/diff?src=pr&el=tree#diff-Z29iYmxpbi15YXJuL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL3lhcm4vR29iYmxpbllhcm5BcHBMYXVuY2hlci5qYXZh) | `20.78% <0%> (-0.25%)` | `8% <0%> (ø)` | |
   | [...apache/gobblin/runtime/util/RuntimeConstructs.java](https://codecov.io/gh/apache/incubator-gobblin/pull/2913/diff?src=pr&el=tree#diff-Z29iYmxpbi1ydW50aW1lL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL3J1bnRpbWUvdXRpbC9SdW50aW1lQ29uc3RydWN0cy5qYXZh) | `0% <0%> (ø)` | `0% <0%> (ø)` | :arrow_down: |
   | [...src/main/java/org/apache/gobblin/runtime/Task.java](https://codecov.io/gh/apache/incubator-gobblin/pull/2913/diff?src=pr&el=tree#diff-Z29iYmxpbi1ydW50aW1lL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL3J1bnRpbWUvVGFzay5qYXZh) | `67.26% <0%> (ø)` | `84% <0%> (ø)` | :arrow_down: |
   | [...in/java/org/apache/gobblin/cluster/SingleTask.java](https://codecov.io/gh/apache/incubator-gobblin/pull/2913/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvU2luZ2xlVGFzay5qYXZh) | `81.48% <0%> (ø)` | `10% <0%> (ø)` | :arrow_down: |
   | [...a/org/apache/gobblin/cluster/SingleTaskRunner.java](https://codecov.io/gh/apache/incubator-gobblin/pull/2913/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvU2luZ2xlVGFza1J1bm5lci5qYXZh) | `87.71% <0%> (ø)` | `11% <0%> (ø)` | :arrow_down: |
   | ... and [11 more](https://codecov.io/gh/apache/incubator-gobblin/pull/2913/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/2913?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/2913?src=pr&el=footer). Last update [64f9339...260ef9e](https://codecov.io/gh/apache/incubator-gobblin/pull/2913?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-gobblin] sv2000 commented on a change in pull request #2913: [GOBBLIN-1073] Add proxy user and requester quota to GaaS

Posted by GitBox <gi...@apache.org>.
sv2000 commented on a change in pull request #2913: [GOBBLIN-1073] Add proxy user and requester quota to GaaS
URL: https://github.com/apache/incubator-gobblin/pull/2913#discussion_r391204237
 
 

 ##########
 File path: gobblin-service/src/main/java/org/apache/gobblin/service/modules/orchestration/DagManager.java
 ##########
 @@ -747,6 +763,55 @@ private void submitJob(DagNode<JobExecutionPlan> dagNode) {
       }
     }
 
+    private void checkQuota(DagNode<JobExecutionPlan> dagNode) throws IOException {
+      String proxyUser = ConfigUtils.getString(dagNode.getValue().getJobSpec().getConfig(), AzkabanProjectConfig.USER_TO_PROXY, null);
+      String specExecutorUri = dagNode.getValue().getSpecExecutor().getUri().toString();
+      boolean proxyUserCheck = true;
+      if (proxyUser != null) {
+        proxyUserCheck = incrementMapAndCheckQuota(proxyUserToJobCount, proxyUser, dagNode);
+      }
+
+      String serializedRequesters = ConfigUtils.getString(dagNode.getValue().getJobSpec().getConfig(), RequesterService.REQUESTER_LIST, null);
+      boolean requesterCheck = true;
+      String requesterMessage = null;
+      if (serializedRequesters != null) {
+        for (ServiceRequester requester : RequesterService.deserialize(serializedRequesters)) {
+          requesterCheck &= incrementMapAndCheckQuota(requesterToJobCount, requester.toString(), dagNode);
+          if (!requesterCheck && requesterMessage == null) {
+            requesterMessage = "Quota exceeded for requester " + requester + " on executor " + specExecutorUri + ": quota="
+                + quota + ", runningJobs=" + requesterToJobCount.get(requester.toString() + "," + specExecutorUri);
+          }
+        }
+      }
+
+      // Throw errors for reach quota at the end to avoid inconsistent job counts
+      if (!proxyUserCheck) {
+        throw new IOException("Quota exceeded for proxy user " + proxyUser + " on executor " + specExecutorUri +
+            ": quota=" + quota + ", runningJobs=" + proxyUserToJobCount.get(proxyUser + "," + specExecutorUri));
+      }
+
+      if (!requesterCheck) {
+        throw new IOException(requesterMessage);
+      }
+    }
+
+    /**
+     * Increment quota by one for the given map and key.
+     * @return true if quota is not reached for this user or user is whitelisted, false otherwise.
+     */
+    private boolean incrementMapAndCheckQuota(Map<String, Integer> quotaMap, String user, DagNode<JobExecutionPlan> dagNode) {
+      String key = user + "," + dagNode.getValue().getSpecExecutor().getUri().toString();
 
 Review comment:
   Move this logic to a separate method. DagManagerUtils.getUserKey()?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-gobblin] sv2000 commented on a change in pull request #2913: [GOBBLIN-1073] Add proxy user and requester quota to GaaS

Posted by GitBox <gi...@apache.org>.
sv2000 commented on a change in pull request #2913: [GOBBLIN-1073] Add proxy user and requester quota to GaaS
URL: https://github.com/apache/incubator-gobblin/pull/2913#discussion_r391203456
 
 

 ##########
 File path: gobblin-service/src/main/java/org/apache/gobblin/service/modules/orchestration/DagManager.java
 ##########
 @@ -747,6 +763,55 @@ private void submitJob(DagNode<JobExecutionPlan> dagNode) {
       }
     }
 
+    private void checkQuota(DagNode<JobExecutionPlan> dagNode) throws IOException {
 
 Review comment:
   Can we distinguish between a normal job failure vs failure due to quota exceeding? 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-gobblin] jack-moseley commented on issue #2913: [GOBBLIN-1073] Add proxy user and requester quota to GaaS

Posted by GitBox <gi...@apache.org>.
jack-moseley commented on issue #2913: [GOBBLIN-1073] Add proxy user and requester quota to GaaS
URL: https://github.com/apache/incubator-gobblin/pull/2913#issuecomment-597794419
 
 
   @sv2000 please review

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-gobblin] sv2000 commented on a change in pull request #2913: [GOBBLIN-1073] Add proxy user and requester quota to GaaS

Posted by GitBox <gi...@apache.org>.
sv2000 commented on a change in pull request #2913: [GOBBLIN-1073] Add proxy user and requester quota to GaaS
URL: https://github.com/apache/incubator-gobblin/pull/2913#discussion_r391204548
 
 

 ##########
 File path: gobblin-service/src/main/java/org/apache/gobblin/service/modules/orchestration/DagManager.java
 ##########
 @@ -785,6 +852,35 @@ private void submitJob(DagNode<JobExecutionPlan> dagNode) {
       }
     }
 
+    /**
+     * Decrement the quota by one for the proxy user and requesters corresponding to the provided {@link DagNode}.
+     */
+    private void releaseQuota(DagNode<JobExecutionPlan> dagNode) {
+      String proxyUser = ConfigUtils.getString(dagNode.getValue().getJobSpec().getConfig(), AzkabanProjectConfig.USER_TO_PROXY, null);
+      String specExecutorUri = dagNode.getValue().getSpecExecutor().getUri().toString();
+
+      if (proxyUser != null) {
+        String proxyUserKey = proxyUser + "," + specExecutorUri;
+        if (proxyUserToJobCount.containsKey(proxyUserKey) && proxyUserToJobCount.get(proxyUserKey) > 0) {
+          proxyUserToJobCount.put(proxyUserKey, proxyUserToJobCount.get(proxyUserKey) - 1);
+        }
+      }
+
+      String serializedRequesters = ConfigUtils.getString(dagNode.getValue().getJobSpec().getConfig(), RequesterService.REQUESTER_LIST, null);
+      if (serializedRequesters != null) {
+        try {
+          for (ServiceRequester requester : RequesterService.deserialize(serializedRequesters)) {
+            String requesterKey = requester.toString() + "," + specExecutorUri;
 
 Review comment:
   Also, define "," as a separate static variable.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-gobblin] sv2000 commented on a change in pull request #2913: [GOBBLIN-1073] Add proxy user and requester quota to GaaS

Posted by GitBox <gi...@apache.org>.
sv2000 commented on a change in pull request #2913: [GOBBLIN-1073] Add proxy user and requester quota to GaaS
URL: https://github.com/apache/incubator-gobblin/pull/2913#discussion_r391187910
 
 

 ##########
 File path: gobblin-service/src/main/java/org/apache/gobblin/service/modules/orchestration/DagManager.java
 ##########
 @@ -747,6 +763,55 @@ private void submitJob(DagNode<JobExecutionPlan> dagNode) {
       }
     }
 
+    private void checkQuota(DagNode<JobExecutionPlan> dagNode) throws IOException {
+      String proxyUser = ConfigUtils.getString(dagNode.getValue().getJobSpec().getConfig(), AzkabanProjectConfig.USER_TO_PROXY, null);
+      String specExecutorUri = dagNode.getValue().getSpecExecutor().getUri().toString();
 
 Review comment:
   Create a method getSpecExecutorUri() in  DagManagerUtils?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-gobblin] jack-moseley commented on a change in pull request #2913: [GOBBLIN-1073] Add proxy user and requester quota to GaaS

Posted by GitBox <gi...@apache.org>.
jack-moseley commented on a change in pull request #2913: [GOBBLIN-1073] Add proxy user and requester quota to GaaS
URL: https://github.com/apache/incubator-gobblin/pull/2913#discussion_r391459558
 
 

 ##########
 File path: gobblin-service/src/main/java/org/apache/gobblin/service/modules/orchestration/DagManager.java
 ##########
 @@ -747,6 +763,55 @@ private void submitJob(DagNode<JobExecutionPlan> dagNode) {
       }
     }
 
+    private void checkQuota(DagNode<JobExecutionPlan> dagNode) throws IOException {
 
 Review comment:
   How would we distinguish? Do you mean by throwing a different type of exception?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-gobblin] sv2000 commented on a change in pull request #2913: [GOBBLIN-1073] Add proxy user and requester quota to GaaS

Posted by GitBox <gi...@apache.org>.
sv2000 commented on a change in pull request #2913: [GOBBLIN-1073] Add proxy user and requester quota to GaaS
URL: https://github.com/apache/incubator-gobblin/pull/2913#discussion_r391204406
 
 

 ##########
 File path: gobblin-service/src/main/java/org/apache/gobblin/service/modules/orchestration/DagManager.java
 ##########
 @@ -785,6 +852,35 @@ private void submitJob(DagNode<JobExecutionPlan> dagNode) {
       }
     }
 
+    /**
+     * Decrement the quota by one for the proxy user and requesters corresponding to the provided {@link DagNode}.
+     */
+    private void releaseQuota(DagNode<JobExecutionPlan> dagNode) {
+      String proxyUser = ConfigUtils.getString(dagNode.getValue().getJobSpec().getConfig(), AzkabanProjectConfig.USER_TO_PROXY, null);
+      String specExecutorUri = dagNode.getValue().getSpecExecutor().getUri().toString();
+
+      if (proxyUser != null) {
+        String proxyUserKey = proxyUser + "," + specExecutorUri;
+        if (proxyUserToJobCount.containsKey(proxyUserKey) && proxyUserToJobCount.get(proxyUserKey) > 0) {
+          proxyUserToJobCount.put(proxyUserKey, proxyUserToJobCount.get(proxyUserKey) - 1);
+        }
+      }
+
+      String serializedRequesters = ConfigUtils.getString(dagNode.getValue().getJobSpec().getConfig(), RequesterService.REQUESTER_LIST, null);
+      if (serializedRequesters != null) {
+        try {
+          for (ServiceRequester requester : RequesterService.deserialize(serializedRequesters)) {
+            String requesterKey = requester.toString() + "," + specExecutorUri;
 
 Review comment:
   Move this to a separate method getRequesterKey()?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-gobblin] sv2000 commented on a change in pull request #2913: [GOBBLIN-1073] Add proxy user and requester quota to GaaS

Posted by GitBox <gi...@apache.org>.
sv2000 commented on a change in pull request #2913: [GOBBLIN-1073] Add proxy user and requester quota to GaaS
URL: https://github.com/apache/incubator-gobblin/pull/2913#discussion_r391186509
 
 

 ##########
 File path: gobblin-service/src/main/java/org/apache/gobblin/service/modules/orchestration/DagManager.java
 ##########
 @@ -362,6 +370,8 @@ public synchronized void setActive(boolean active) {
    */
   public static class DagManagerThread implements Runnable {
     private final Map<DagNode<JobExecutionPlan>, Dag<JobExecutionPlan>> jobToDag = new HashMap<>();
+    private static final Map<String, Integer> proxyUserToJobCount = new ConcurrentHashMap<>();
 
 Review comment:
   Should this be a global map shared across all threads? IIRC, we use flowName, flowGroup and flowExecutionId to map a given flow execution to a DagManagerThread.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-gobblin] codecov-io edited a comment on issue #2913: [GOBBLIN-1073] Add proxy user and requester quota to GaaS

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on issue #2913: [GOBBLIN-1073] Add proxy user and requester quota to GaaS
URL: https://github.com/apache/incubator-gobblin/pull/2913#issuecomment-597413059
 
 
   # [Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/2913?src=pr&el=h1) Report
   > Merging [#2913](https://codecov.io/gh/apache/incubator-gobblin/pull/2913?src=pr&el=desc) into [master](https://codecov.io/gh/apache/incubator-gobblin/commit/64f9339027e4cbaec320ae7849a4f47e2d71e1c9&el=desc) will **increase** coverage by `0.01%`.
   > The diff coverage is `38.88%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/incubator-gobblin/pull/2913/graphs/tree.svg?width=650&height=150&src=pr&token=4MgURJ0bGc)](https://codecov.io/gh/apache/incubator-gobblin/pull/2913?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #2913      +/-   ##
   ============================================
   + Coverage     45.85%   45.86%   +0.01%     
   + Complexity     9187     9186       -1     
   ============================================
     Files          1934     1934              
     Lines         72858    72981     +123     
     Branches       8033     8057      +24     
   ============================================
   + Hits          33411    33476      +65     
   - Misses        36382    36428      +46     
   - Partials       3065     3077      +12     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-gobblin/pull/2913?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [...blin/service/modules/orchestration/DagManager.java](https://codecov.io/gh/apache/incubator-gobblin/pull/2913/diff?src=pr&el=tree#diff-Z29iYmxpbi1zZXJ2aWNlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL3NlcnZpY2UvbW9kdWxlcy9vcmNoZXN0cmF0aW9uL0RhZ01hbmFnZXIuamF2YQ==) | `72.01% <38.88%> (-4.46%)` | `13.00 <0.00> (ø)` | |
   | [...ache/gobblin/cluster/InMemorySingleTaskRunner.java](https://codecov.io/gh/apache/incubator-gobblin/pull/2913/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvSW5NZW1vcnlTaW5nbGVUYXNrUnVubmVyLmphdmE=) | `75.00% <0.00%> (-25.00%)` | `3.00% <0.00%> (ø%)` | |
   | [.../org/apache/gobblin/metrics/RootMetricContext.java](https://codecov.io/gh/apache/incubator-gobblin/pull/2913/diff?src=pr&el=tree#diff-Z29iYmxpbi1tZXRyaWNzLWxpYnMvZ29iYmxpbi1tZXRyaWNzLWJhc2Uvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dvYmJsaW4vbWV0cmljcy9Sb290TWV0cmljQ29udGV4dC5qYXZh) | `78.12% <0.00%> (-1.57%)` | `15.00% <0.00%> (-1.00%)` | |
   | [.../org/apache/gobblin/cluster/GobblinTaskRunner.java](https://codecov.io/gh/apache/incubator-gobblin/pull/2913/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvR29iYmxpblRhc2tSdW5uZXIuamF2YQ==) | `64.00% <0.00%> (-1.07%)` | `26.00% <0.00%> (-3.00%)` | |
   | [.../apache/gobblin/cluster/GobblinClusterManager.java](https://codecov.io/gh/apache/incubator-gobblin/pull/2913/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvR29iYmxpbkNsdXN0ZXJNYW5hZ2VyLmphdmE=) | `53.91% <0.00%> (-1.04%)` | `26.00% <0.00%> (-2.00%)` | |
   | [...rg/apache/gobblin/yarn/GobblinYarnAppLauncher.java](https://codecov.io/gh/apache/incubator-gobblin/pull/2913/diff?src=pr&el=tree#diff-Z29iYmxpbi15YXJuL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL3lhcm4vR29iYmxpbllhcm5BcHBMYXVuY2hlci5qYXZh) | `20.78% <0.00%> (-0.25%)` | `8.00% <0.00%> (ø%)` | |
   | [...src/main/java/org/apache/gobblin/runtime/Task.java](https://codecov.io/gh/apache/incubator-gobblin/pull/2913/diff?src=pr&el=tree#diff-Z29iYmxpbi1ydW50aW1lL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL3J1bnRpbWUvVGFzay5qYXZh) | `67.26% <0.00%> (ø)` | `84.00% <0.00%> (ø%)` | |
   | [...in/java/org/apache/gobblin/cluster/SingleTask.java](https://codecov.io/gh/apache/incubator-gobblin/pull/2913/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvU2luZ2xlVGFzay5qYXZh) | `81.48% <0.00%> (ø)` | `10.00% <0.00%> (ø%)` | |
   | [...a/org/apache/gobblin/cluster/SingleTaskRunner.java](https://codecov.io/gh/apache/incubator-gobblin/pull/2913/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvU2luZ2xlVGFza1J1bm5lci5qYXZh) | `87.71% <0.00%> (ø)` | `11.00% <0.00%> (ø%)` | |
   | [.../org/apache/gobblin/util/retry/RetryerFactory.java](https://codecov.io/gh/apache/incubator-gobblin/pull/2913/diff?src=pr&el=tree#diff-Z29iYmxpbi11dGlsaXR5L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL3V0aWwvcmV0cnkvUmV0cnllckZhY3RvcnkuamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00% <0.00%> (ø%)` | |
   | ... and [11 more](https://codecov.io/gh/apache/incubator-gobblin/pull/2913/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/2913?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/2913?src=pr&el=footer). Last update [64f9339...260ef9e](https://codecov.io/gh/apache/incubator-gobblin/pull/2913?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-gobblin] sv2000 commented on a change in pull request #2913: [GOBBLIN-1073] Add proxy user and requester quota to GaaS

Posted by GitBox <gi...@apache.org>.
sv2000 commented on a change in pull request #2913: [GOBBLIN-1073] Add proxy user and requester quota to GaaS
URL: https://github.com/apache/incubator-gobblin/pull/2913#discussion_r391188073
 
 

 ##########
 File path: gobblin-service/src/main/java/org/apache/gobblin/service/modules/orchestration/DagManager.java
 ##########
 @@ -747,6 +763,55 @@ private void submitJob(DagNode<JobExecutionPlan> dagNode) {
       }
     }
 
+    private void checkQuota(DagNode<JobExecutionPlan> dagNode) throws IOException {
+      String proxyUser = ConfigUtils.getString(dagNode.getValue().getJobSpec().getConfig(), AzkabanProjectConfig.USER_TO_PROXY, null);
+      String specExecutorUri = dagNode.getValue().getSpecExecutor().getUri().toString();
+      boolean proxyUserCheck = true;
+      if (proxyUser != null) {
+        proxyUserCheck = incrementMapAndCheckQuota(proxyUserToJobCount, proxyUser, dagNode);
+      }
+
+      String serializedRequesters = ConfigUtils.getString(dagNode.getValue().getJobSpec().getConfig(), RequesterService.REQUESTER_LIST, null);
 
 Review comment:
   same comment as for specExecutorUri.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services