spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andrewor14 <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-4879] Use driver to coordinate Hadoop o...
Date Tue, 10 Feb 2015 23:13:37 GMT
Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4066#discussion_r24460688
  
    --- Diff: core/src/test/scala/org/apache/spark/scheduler/OutputCommitCoordinatorSuite.scala
---
    @@ -0,0 +1,210 @@
    +/*
    + * 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
    +
    +import java.io.File
    +import java.util.concurrent.TimeoutException
    +
    +import org.mockito.Matchers
    +import org.mockito.Mockito._
    +import org.mockito.invocation.InvocationOnMock
    +import org.mockito.stubbing.Answer
    +import org.scalatest.{BeforeAndAfter, FunSuite}
    +
    +import org.apache.hadoop.mapred.{TaskAttemptID, JobConf, TaskAttemptContext, OutputCommitter}
    +
    +import org.apache.spark._
    +import org.apache.spark.rdd.{RDD, FakeOutputCommitter}
    +import org.apache.spark.util.Utils
    +
    +import scala.concurrent.Await
    +import scala.concurrent.duration._
    +import scala.language.postfixOps
    +
    +/**
    + * Unit tests for the output commit coordination functionality.
    + *
    + * The unit test makes both the original task and the speculated task
    + * attempt to commit, where committing is emulated by creating a
    + * directory. If both tasks create directories then the end result is
    + * a failure.
    + *
    + * Note that there are some aspects of this test that are less than ideal.
    + * In particular, the test mocks the speculation-dequeuing logic to always
    + * dequeue a task and consider it as speculated. Immediately after initially
    + * submitting the tasks and calling reviveOffers(), reviveOffers() is invoked
    + * again to pick up the speculated task. This may be hacking the original
    + * behavior in too much of an unrealistic fashion.
    + *
    + * Also, the validation is done by checking the number of files in a directory.
    + * Ideally, an accumulator would be used for this, where we could increment
    + * the accumulator in the output committer's commitTask() call. If the call to
    + * commitTask() was called twice erroneously then the test would ideally fail because
    + * the accumulator would be incremented twice.
    + *
    + * The problem with this test implementation is that when both a speculated task and
    + * its original counterpart complete, only one of the accumulator's increments is
    + * captured. This results in a paradox where if the OutputCommitCoordinator logic
    + * was not in SparkHadoopWriter, the tests would still pass because only one of the
    + * increments would be captured even though the commit in both tasks was executed
    + * erroneously.
    + */
    +class OutputCommitCoordinatorSuite extends FunSuite with BeforeAndAfter {
    +
    +  var outputCommitCoordinator: OutputCommitCoordinator = null
    +  var tempDir: File = null
    +  var sc: SparkContext = null
    +
    +  before {
    +    tempDir = Utils.createTempDir()
    +    val conf = new SparkConf()
    +      .setMaster("local[4]")
    +      .setAppName(classOf[OutputCommitCoordinatorSuite].getSimpleName)
    +      .set("spark.speculation", "true")
    +    sc = new SparkContext(conf) {
    +      override private[spark] def createSparkEnv(
    +        conf: SparkConf,
    +        isLocal: Boolean,
    +        listenerBus: LiveListenerBus): SparkEnv = {
    --- End diff --
    
    indent these once more


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message