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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to