fix travis; fix port error

This commit is contained in:
Kent Yao 2018-07-27 20:02:52 +08:00
parent 53eb12f60f
commit 3b98cdd063
5 changed files with 30 additions and 40 deletions

View File

@ -126,12 +126,6 @@
<filtering>true</filtering>
</resource>
</resources>
<testResources>
<testResource>
<directory>${project.build.directory}/extra-resources</directory>
<filtering>true</filtering>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@ -155,6 +149,23 @@
<goal>run</goal>
</goals>
</execution>
<execution>
<id>build-info-test</id>
<phase>generate-test-resources</phase>
<configuration>
<target>
<exec executable="bash">
<arg value="${project.basedir}/../build/kyuubi-build-info"/>
<arg value="${project.build.testOutputDirectory}"/>
<arg value="${project.version}"/>
<arg value="${spark.version}"/>
</exec>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
<execution>
<id>fake-jar-test</id>
<phase>generate-test-resources</phase>
@ -243,18 +254,6 @@
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>add-default-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>v${hive.version.short}/src/main/scala</source>
</sources>
</configuration>
</execution>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
@ -288,14 +287,9 @@
<reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
<junitxml>.</junitxml>
<filereports>TestSuite.txt</filereports>
<argLine>-Xmx3g -Xss4m -XX:ReservedCodeCacheSize=512m</argLine>
<stderr/>
<environmentVariables>
<KYUUBI_JAR>${project.build.testOutputDirectory}/kyuubi-server-${project.version}.jar</KYUUBI_JAR>
</environmentVariables>
<systemProperties>
<java.io.tmpdir>${project.build.testOutputDirectory}/tmp</java.io.tmpdir>
</systemProperties>
</configuration>
<executions>
<execution>

View File

@ -22,6 +22,7 @@ import java.net.URI
import java.nio.ByteBuffer
import java.nio.charset.StandardCharsets
import java.security.PrivilegedExceptionAction
import java.text.SimpleDateFormat
import java.util.{Locale, Properties, UUID}
import java.util.concurrent.Callable
import java.util.zip.{ZipEntry, ZipOutputStream}
@ -129,11 +130,11 @@ private[yarn] class KyuubiYarnClient(conf: SparkConf) extends Logging {
case ioe: IOException =>
warn("Failed to cleanup staging dir " + appStagingDir, ioe)
} finally {
killApplication
killApplication()
}
}
def killApplication: Unit = {
def killApplication(): Unit = {
try {
yarnClient.killApplication(appId)
} catch {
@ -290,8 +291,8 @@ private[yarn] class KyuubiYarnClient(conf: SparkConf) extends Logging {
}
val localResources = new HashMap[String, LocalResource]
FileSystem.mkdirs(fs, appStagingDir, new FsPermission(STAGING_DIR_PERMISSION))
val symlinkCache: Map[URI, Path] = HashMap[URI, Path]()
val statCache: Map[URI, FileStatus] = HashMap[URI, FileStatus]()
val symlinkCache = HashMap[URI, Path]()
val statCache = HashMap[URI, FileStatus]()
/**
* Copy the non-local file to HDFS (if not already there) and add it to the Application Master's
@ -470,15 +471,17 @@ private[yarn] class KyuubiYarnClient(conf: SparkConf) extends Logging {
}
private[this] val stateChecker: Callable[Boolean] = new Callable[Boolean] {
private val timeout = conf.getTimeAsMs(KyuubiConf.YARN_CONTAINER_TIMEOUT.key)
private val timeout = conf.getTimeAsMs(KyuubiConf.YARN_CONTAINER_TIMEOUT.key, "60s")
import YarnApplicationState._
override def call(): Boolean = {
try {
val report = yarnClient.getApplicationReport(appId)
info(formatReportDetails(report))
report.getYarnApplicationState match {
val state = report.getYarnApplicationState
if (state != ACCEPTED) info(formatReportDetails(report))
info(s"Application report for $appId[$state]")
state match {
case RUNNING => false
case ACCEPTED | NEW | NEW_SAVING | SUBMITTED =>
if (System.currentTimeMillis - report.getStartTime < timeout) {
@ -502,18 +505,17 @@ private[yarn] class KyuubiYarnClient(conf: SparkConf) extends Logging {
}
def formatReportDetails(report: ApplicationReport): String = {
val details = Seq[(String, String)](
Seq(
("Client token", Option(report.getClientToAMToken).map(_.toString).getOrElse("")),
("Diagnostics", report.getDiagnostics),
("Kyuubi server host", report.getHost),
("Bind port", report.getRpcPort.toString),
("Queue", report.getQueue),
("Start time", report.getStartTime.toString),
("Start time", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(report.getStartTime)),
("Final status", Option(report.getFinalApplicationStatus).map(_.toString).getOrElse("")),
("Tracking URL", report.getTrackingUrl),
("User", report.getUser)
)
details.map { case (k, v) =>
).map { case (k, v) =>
val newValue = Option(v).filter(_.nonEmpty).getOrElse("N/A")
s"\n\t $k: $newValue"
}.mkString("")
@ -619,7 +621,6 @@ object KyuubiYarnClient {
*/
def startKyuubiAppMaster(): Unit = {
val conf = new SparkConf()
KyuubiConf.getAllDefaults.foreach(kv => conf.setIfMissing(kv._1, kv._2))
new KyuubiYarnClient(conf).submit()
}
}

View File

@ -36,7 +36,6 @@ class packageSuite extends SparkFunSuite {
assert(props.getProperty("revision") === REVISION)
assert(props.getProperty("user") === BUILD_USER)
assert(props.getProperty("url") === REPO_URL)
assert(props.getProperty("date") === BUILD_DATE)
}
}

View File

@ -131,8 +131,6 @@ class KyuubiYarnClientSuite extends SparkFunSuite with Matchers with MockitoSuga
test("kyuubi yarn client init") {
val conf = new SparkConf()
KyuubiConf.getAllDefaults.foreach(kv => conf.setIfMissing(kv._1, kv._2))
val client = new KyuubiYarnClient(conf)
assert(ReflectUtils.getFieldValue(client,
"yaooqinn$kyuubi$yarn$KyuubiYarnClient$$hadoopConf").isInstanceOf[YarnConfiguration])
@ -242,7 +240,6 @@ class KyuubiYarnClientSuite extends SparkFunSuite with Matchers with MockitoSuga
def withClientBase(f: (YarnClient, KyuubiYarnClient) => Any): Unit = {
val conf = new SparkConf()
KyuubiConf.getAllDefaults.foreach(kv => conf.setIfMissing(kv._1, kv._2))
val client = new KyuubiYarnClient(conf)
val yarnClient = mock[YarnClient]
ReflectUtils.setFieldValue(client,

View File

@ -61,7 +61,6 @@
<hadoop.deps.scope>provided</hadoop.deps.scope>
<hive.group>org.spark-project.hive</hive.group>
<hive.version>1.2.1.spark2</hive.version>
<hive.version.short>1.2.1</hive.version.short>
<hive.deps.scope>provided</hive.deps.scope>
<jpam.version>1.1</jpam.version>
<apacheds.version>2.0.0-M15</apacheds.version>