sv2000 commented on a change in pull request #2955: [GOBBLIN-1115] Add flow 
level data movement authorization in gaas
URL: https://github.com/apache/incubator-gobblin/pull/2955#discussion_r408596175
 
 

 ##########
 File path: 
gobblin-service/src/main/java/org/apache/gobblin/service/modules/flow/MultiHopFlowCompiler.java
 ##########
 @@ -169,15 +186,26 @@ public void awaitHealthy() throws InterruptedException {
 
     FlowSpec flowSpec = (FlowSpec) spec;
     String source = ConfigUtils.getString(flowSpec.getConfig(), 
ServiceConfigKeys.FLOW_SOURCE_IDENTIFIER_KEY, "");
-    String destination =
-        ConfigUtils.getString(flowSpec.getConfig(), 
ServiceConfigKeys.FLOW_DESTINATION_IDENTIFIER_KEY, "");
+    String destination = ConfigUtils.getString(flowSpec.getConfig(), 
ServiceConfigKeys.FLOW_DESTINATION_IDENTIFIER_KEY, "");
+
+    DataNode sourceNode = this.flowGraph.getNode(source);
+    List<String> destNodeIds = ConfigUtils.getStringList(flowSpec.getConfig(), 
ServiceConfigKeys.FLOW_DESTINATION_IDENTIFIER_KEY);
+    List<DataNode> destNodes = 
destNodeIds.stream().map(this.flowGraph::getNode).collect(Collectors.toList());
+
     log.info(String.format("Compiling flow for source: %s and destination: 
%s", source, destination));
 
     List<FlowSpec> flowSpecs = splitFlowSpec(flowSpec);
     Dag<JobExecutionPlan> jobExecutionPlanDag = new Dag<>(new ArrayList<>());
     try {
       this.rwLock.readLock().lock();
       for (FlowSpec datasetFlowSpec : flowSpecs) {
+        for (DataNode destNode : destNodes) {
+          if (!this.dataMovementAuthorizer.isMovementAuthorized(flowSpec, 
sourceNode, destNode)) {
+            log.error("Data movement is not authorized");
 
 Review comment:
   Add source/dest nodes and FlowConfig in the log message.

----------------------------------------------------------------
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