This is an automated email from the ASF dual-hosted git repository.
suvasude pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-gobblin.git
The following commit(s) were added to refs/heads/master by this push:
new 88780bc [GOBBLIN-1258] Add error message in status for unauthorized
flows
88780bc is described below
commit 88780bc92667b58916f7d4b2cc1c5f01eee35c5f
Author: Jack Moseley <[email protected]>
AuthorDate: Wed Sep 9 10:12:36 2020 -0700
[GOBBLIN-1258] Add error message in status for unauthorized flows
Closes #3098 from jack-moseley/authorize-message
---
.../apache/gobblin/service/FlowConfigV2ResourceLocalHandler.java | 4 ++--
.../apache/gobblin/service/modules/flow/MultiHopFlowCompiler.java | 6 ++++--
.../apache/gobblin/service/modules/orchestration/Orchestrator.java | 4 ++--
3 files changed, 8 insertions(+), 6 deletions(-)
diff --git
a/gobblin-restli/gobblin-flow-config-service/gobblin-flow-config-service-server/src/main/java/org/apache/gobblin/service/FlowConfigV2ResourceLocalHandler.java
b/gobblin-restli/gobblin-flow-config-service/gobblin-flow-config-service-server/src/main/java/org/apache/gobblin/service/FlowConfigV2ResourceLocalHandler.java
index 0990338..86fead8 100644
---
a/gobblin-restli/gobblin-flow-config-service/gobblin-flow-config-service-server/src/main/java/org/apache/gobblin/service/FlowConfigV2ResourceLocalHandler.java
+++
b/gobblin-restli/gobblin-flow-config-service/gobblin-flow-config-service-server/src/main/java/org/apache/gobblin/service/FlowConfigV2ResourceLocalHandler.java
@@ -83,9 +83,9 @@ public class FlowConfigV2ResourceLocalHandler extends
FlowConfigResourceLocalHan
} else if
(Boolean.parseBoolean(responseMap.getOrDefault(ServiceConfigKeys.COMPILATION_SUCCESSFUL,
new AddSpecResponse<>("false")).getValue().toString())) {
httpStatus = HttpStatus.S_201_CREATED;
} else {
- String message = "Flow was not compiled successfully. It may be due to
no path being found";
+ String message = "Flow was not compiled successfully.";
if (!flowSpec.getCompilationErrors().isEmpty()) {
- message = message + " or due to " + flowSpec.getCompilationErrors();
+ message = message + " Compilation errors encountered: " +
flowSpec.getCompilationErrors();
}
throw new RestLiServiceException(HttpStatus.S_400_BAD_REQUEST, message);
}
diff --git
a/gobblin-service/src/main/java/org/apache/gobblin/service/modules/flow/MultiHopFlowCompiler.java
b/gobblin-service/src/main/java/org/apache/gobblin/service/modules/flow/MultiHopFlowCompiler.java
index 9b1ec16..2d0874e 100644
---
a/gobblin-service/src/main/java/org/apache/gobblin/service/modules/flow/MultiHopFlowCompiler.java
+++
b/gobblin-service/src/main/java/org/apache/gobblin/service/modules/flow/MultiHopFlowCompiler.java
@@ -204,8 +204,10 @@ public class MultiHopFlowCompiler extends
BaseFlowToJobSpecCompiler {
boolean authorized =
this.dataMovementAuthorizer.isMovementAuthorized(flowSpec, sourceNode,
destNode);
Instrumented.updateTimer(dataAuthorizationTimer, System.nanoTime() -
authStartTime, TimeUnit.NANOSECONDS);
if (!authorized) {
- log.error(String.format("Data movement is not authorized for flow:
%s, source: %s, destination: %s",
- flowSpec.getUri().toString(), source, destination));
+ String message = String.format("Data movement is not authorized
for flow: %s, source: %s, destination: %s",
+ flowSpec.getUri().toString(), source, destination);
+ log.error(message);
+ datasetFlowSpec.getCompilationErrors().add(message);
return null;
}
}
diff --git
a/gobblin-service/src/main/java/org/apache/gobblin/service/modules/orchestration/Orchestrator.java
b/gobblin-service/src/main/java/org/apache/gobblin/service/modules/orchestration/Orchestrator.java
index ae0daea..af7eb94 100644
---
a/gobblin-service/src/main/java/org/apache/gobblin/service/modules/orchestration/Orchestrator.java
+++
b/gobblin-service/src/main/java/org/apache/gobblin/service/modules/orchestration/Orchestrator.java
@@ -264,9 +264,9 @@ public class Orchestrator implements SpecCatalogListener,
Instrumentable {
flowMetadata.putIfAbsent(TimingEvent.FlowEventConstants.FLOW_EXECUTION_ID_FIELD,
Long.toString(System.currentTimeMillis()));
- String message = "Flow was not compiled successfully. It may be due to
no path being found";
+ String message = "Flow was not compiled successfully.";
if (!((FlowSpec) spec).getCompilationErrors().isEmpty()) {
- message = message + " or due to " + ((FlowSpec)
spec).getCompilationErrors();
+ message = message + " Compilation errors encountered: " +
((FlowSpec) spec).getCompilationErrors();
}
flowMetadata.put(TimingEvent.METADATA_MESSAGE, message);