Skip to content

Commit d55652b

Browse files
authored
Merge pull request #562 from juripetersen/logging-in-collect
Add explain to json config to Job
2 parents 9bad982 + e08a898 commit d55652b

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

wayang-api/wayang-api-scala-java/src/main/scala/org/apache/wayang/api/PlanBuilder.scala

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,13 @@ class PlanBuilder(private[api] val wayangContext: WayangContext, private var job
102102
*/
103103
def buildAndExecute(): Unit = {
104104
val plan: WayangPlan = new WayangPlan(this.sinks.toArray: _*)
105-
if (this.experiment == null) this.wayangContext.execute(jobName, plan, this.udfJars.toArray: _*)
106-
else this.wayangContext.execute(jobName, plan, this.experiment, this.udfJars.toArray: _*)
105+
106+
if (this.experiment == null) {
107+
this.wayangContext.execute(jobName, plan, this.udfJars.toArray: _*)
108+
}
109+
else {
110+
this.wayangContext.execute(jobName, plan, this.experiment, this.udfJars.toArray: _*)
111+
}
107112
}
108113

109114
/**

wayang-commons/wayang-core/src/main/java/org/apache/wayang/core/api/Job.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
import org.apache.wayang.core.util.OneTimeExecutable;
6868
import org.apache.wayang.core.util.ReflectionUtils;
6969
import org.apache.wayang.core.util.WayangCollections;
70+
import org.apache.wayang.core.util.ExplainUtils;
7071
import org.apache.logging.log4j.LogManager;
7172
import org.apache.logging.log4j.Logger;
7273

@@ -304,6 +305,16 @@ protected void doExecute() {
304305
this.logger.warn("Failed to initialize monitor: {}", e);
305306
}
306307

308+
if (this.configuration.getBooleanProperty("wayang.core.explain.enabled")) {
309+
ExplainUtils.write(
310+
ExplainUtils.parsePlan(this.wayangPlan, true),
311+
this.configuration.getStringProperty("wayang.core.explain.logical.file")
312+
);
313+
ExplainUtils.write(
314+
ExplainUtils.parsePlan(executionPlan, true),
315+
this.configuration.getStringProperty("wayang.core.explain.execution.file")
316+
);
317+
}
307318

308319
// Take care of the execution.
309320
while (!this.execute(executionPlan, executionId)) {

wayang-commons/wayang-core/src/main/resources/wayang-core-defaults.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ wayang.core.optimizer.enumeration.branchesfirst = false
2929
wayang.core.log.enabled = true
3030
# wayang.core.log.cardinalities = ~/.wayang/cardinalities.json
3131
# wayang.core.log.executions = ~/.wayang/executions.json
32+
wayang.core.explain.enabled = false
3233

3334
# Configure re-optimization.
3435
wayang.core.optimizer.reoptimize = false

0 commit comments

Comments
 (0)