sv2000 commented on a change in pull request #2981:
URL: https://github.com/apache/incubator-gobblin/pull/2981#discussion_r421813658
##########
File path:
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/spec_catalog/FlowCatalog.java
##########
@@ -325,12 +325,14 @@ public Spec getSpecWrapper(URI uri) {
return responseMap;
}
- private boolean isCompileSuccessful(Map<String, AddSpecResponse>
responseMap) {
+ public static boolean isCompileSuccessful(Map<String, AddSpecResponse>
responseMap) {
AddSpecResponse<String> addSpecResponse =
responseMap.getOrDefault(ServiceConfigKeys.GOBBLIN_SERVICE_JOB_SCHEDULER_LISTENER_CLASS,
new AddSpecResponse<>(""));
- return addSpecResponse != null
- && addSpecResponse.getValue() != null
- && !addSpecResponse.getValue().contains("ConfigException");
+ return isCompileSuccessful(addSpecResponse.getValue());
+ }
+
+ public static boolean isCompileSuccessful(String dag) {
Review comment:
Can we move this method into BaseFlowCompiler class and expose the
method via compiler interface? It seems like a property of the compiler.
Definitely, not that of FlowCatalog.
##########
File path:
gobblin-service/src/main/java/org/apache/gobblin/service/modules/scheduler/GobblinServiceJobScheduler.java
##########
@@ -293,19 +294,27 @@ public AddSpecResponse onAddSpec(Spec addedSpec) {
response =
Arrays.toString(flowSpec.getCompilationErrors().toArray());
}
- if (!isExplain) {
+ boolean compileSuccess = FlowCatalog.isCompileSuccessful(response);
+
+ if (!isExplain && compileSuccess) {
this.scheduledFlowSpecs.put(addedSpec.getUri().toString(),
addedSpec);
if (jobConfig.containsKey(ConfigurationKeys.JOB_SCHEDULE_KEY)) {
_log.info("{} Scheduling flow spec: {} ", this.serviceName,
addedSpec);
scheduleJob(jobConfig, null);
if (PropertiesUtils.getPropAsBoolean(jobConfig,
ConfigurationKeys.FLOW_RUN_IMMEDIATELY, "false")) {
_log.info("RunImmediately requested, hence executing FlowSpec: "
+ addedSpec);
- this.jobExecutor.execute(new
NonScheduledJobRunner(flowSpec.getUri(), false, jobConfig, null));
+ this.jobExecutor.execute(new NonScheduledJobRunner(flowSpecUri,
false, jobConfig, null));
}
} else {
_log.info("No FlowSpec schedule found, so running FlowSpec: " +
addedSpec);
- this.jobExecutor.execute(new
NonScheduledJobRunner(flowSpec.getUri(), true, jobConfig, null));
+ this.jobExecutor.execute(new NonScheduledJobRunner(flowSpecUri,
true, jobConfig, null));
+ }
+ } else {
+ _log.info("Removing the flow spec: {}, since it is an EXPLAIN
request or the flow compilation failed.", addedSpec);
Review comment:
Any chance we can distinguish the log message based on whether it is an
explain query of compile failed? Will help debugging.
----------------------------------------------------------------
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:
[email protected]