0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

spark yarn modeのアプリのintellij上でjunit test caseの実行

Last updated at Posted at 2016-02-18
  • yarnのresource managerが読めないっておこられたら、yarn-site.xml等のhadoop config fileを src/main/resources以下に配置する。
  • yarn-site.xmlでhost nameを設定しているが、logでは0.0.0.0:8032をRMProxyが読もうとしてエラー
  • 環境変数を設定してもだめだった。。。
  • original jarはtest case内で setJarsする。
  • intellijで依存性を設定してもだめだった。。。
  • これで、テストできる。
Test.scala

/**
  * Created by mrikitoku on 16/02/18.
  */
class Test {

  @Test
  def testAsRdd(): Unit = {
    val conf = new SparkConf().setAppName(s"Test")
    // for yarn client mode
    conf.setMaster("yarn-client")
    // set original jars
    conf.setJars(Array("./target/scala-2.10/ほげほげ.jar"))
    conf.set("deploy-mode", "client")
    val sc = new SparkContext(conf)
    
    // target methods for test
    val rdd = asRdd(sc, arg1, arg2...)
    assertTrue(rdd.isDefined)
    val c = rdd.get.count()

    println(s"#rdd: $c")
  }
}

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?