Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import org.apache.beam.runners.spark.translation.TransformTranslator;
import org.apache.beam.runners.spark.translation.streaming.Checkpoint.CheckpointDir;
import org.apache.beam.runners.spark.translation.streaming.SparkRunnerStreamingContextFactory;
import org.apache.beam.runners.spark.translation.streaming.StreamingTransformTranslator;
import org.apache.beam.runners.spark.util.GlobalWatermarkHolder.WatermarksListener;
import org.apache.beam.sdk.Pipeline;
import org.apache.beam.sdk.io.Read;
Expand Down Expand Up @@ -163,11 +162,6 @@ public SparkPipelineResult run(final Pipeline pipeline) {
JavaStreamingContext.getOrCreate(checkpointDir.getSparkCheckpointDir().toString(),
contextFactory);

// update cache candidates
translator = new StreamingTransformTranslator.Translator(
new TransformTranslator.Translator());
updateCacheCandidates(pipeline, translator, contextFactory.getEvaluationContext());

// Checkpoint aggregator/metrics values
jssc.addStreamingListener(
new JavaStreamingListenerWrapper(
Expand Down Expand Up @@ -269,7 +263,7 @@ private void detectTranslationMode(Pipeline pipeline) {
/**
* Evaluator that update/populate the cache candidates.
*/
private void updateCacheCandidates(
public static void updateCacheCandidates(
Pipeline pipeline,
SparkPipelineTranslator translator,
EvaluationContext evaluationContext) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ public JavaStreamingContext create() {
SparkRunner.initAccumulators(options, jsc);

ctxt = new EvaluationContext(jsc, pipeline, jssc);
// update cache candidates
SparkRunner.updateCacheCandidates(pipeline, translator, ctxt);
pipeline.traverseTopologically(new SparkRunner.Evaluator(translator, ctxt));
ctxt.computeOutputs();

Expand All @@ -91,10 +93,6 @@ public JavaStreamingContext create() {
return jssc;
}

public EvaluationContext getEvaluationContext() {
return this.ctxt;
}

private void checkpoint(JavaStreamingContext jssc) {
Path rootCheckpointPath = checkpointDir.getRootCheckpointDir();
Path sparkCheckpointPath = checkpointDir.getSparkCheckpointDir();
Expand Down