Github user vanzin commented on a diff in the pull request:
https://github.com/apache/spark/pull/7786#discussion_r40484064
--- Diff:
core/src/test/scala/org/apache/spark/scheduler/cluster/CoarseGrainedSchedulerBackendSuite.scala
---
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.scheduler.cluster
+
+import java.util.concurrent.ConcurrentHashMap
+
+import scala.collection.mutable
+import scala.collection.JavaConverters._
+
+import org.apache.spark.{LocalSparkContext, SparkConf, SparkContext,
SparkException, SparkFunSuite}
+import org.apache.spark.scheduler.{SparkListenerTaskStart, SparkListener}
+import org.apache.spark.util.{AkkaUtils, SerializableBuffer}
+
+class CoarseGrainedSchedulerBackendSuite extends SparkFunSuite with
LocalSparkContext {
+ import CoarseGrainedSchedulerBackendSuite._
+
+ test("serialized task larger than akka frame size") {
+ val conf = new SparkConf
+ conf.set("spark.akka.frameSize", "1")
+ conf.set("spark.default.parallelism", "1")
+ sc = new SparkContext("local-cluster[2, 1, 1024]", "test", conf)
+ val frameSize = AkkaUtils.maxFrameSizeBytes(sc.conf)
+ val buffer = new SerializableBuffer(java.nio.ByteBuffer.allocate(2 *
frameSize))
+ val larger = sc.parallelize(Seq(buffer))
+ val thrown = intercept[SparkException] {
+ larger.collect()
+ }
+ assert(thrown.getMessage.contains("using broadcast variables for large
values"))
+ val smaller = sc.parallelize(1 to 4).collect()
+ assert(smaller.size === 4)
+ }
+
+ test("avoid scheduling tasks on preempted executors") {
+ // Initialize the SparkContext add register the listener
+ val conf = new SparkConf()
+ sc = new SparkContext("local-cluster[2, 1, 1024]", "test", conf)
+ val taskTracker = new TaskStateTracker
+ sc.addSparkListener(taskTracker)
+
+ sc.parallelize(1 to 100).collect()
+ taskTracker.taskSet.clear()
+
+ val backend = sc.schedulerBackend
+ val executors = {
+ val method = backend.getClass.getSuperclass.getDeclaredMethod(
--- End diff --
Hmmm, no. If you need access to this field, make it visible, or use
`PrivateMethodTester`.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]