Skip to content

Commit 725f090

Browse files
Add config parameter to allow dynamic allocation if the user explicitly sets it.
1 parent b3f9a95 commit 725f090

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

streaming/src/main/scala/org/apache/spark/streaming/StreamingContext.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import org.apache.spark.streaming.dstream._
4444
import org.apache.spark.streaming.receiver.{ActorReceiver, ActorSupervisorStrategy, Receiver}
4545
import org.apache.spark.streaming.scheduler.{JobScheduler, StreamingListener}
4646
import org.apache.spark.streaming.ui.{StreamingJobProgressListener, StreamingTab}
47-
import org.apache.spark.util.{Utils, CallSite, ShutdownHookManager, ThreadUtils}
47+
import org.apache.spark.util.{CallSite, ShutdownHookManager, ThreadUtils, Utils}
4848

4949
/**
5050
* Main entry point for Spark Streaming functionality. It provides methods used to create
@@ -565,7 +565,10 @@ class StreamingContext private[streaming] (
565565
}
566566
}
567567

568-
require(!Utils.isDynamicAllocationEnabled(sc.conf),
568+
val enableDynamicAllocation =
569+
sc.conf.getBoolean("spark.streaming.dynamicAllocation.enabled", defaultValue = false)
570+
571+
require(enableDynamicAllocation || !Utils.isDynamicAllocationEnabled(sc.conf),
569572
"Dynamic allocation is not supported with Spark Streaming currently, since it " +
570573
s"could lead to data loss in some cases. ")
571574
}

0 commit comments

Comments
 (0)