forked from apache/kyuubi
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
1,310 additions
and
15 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...ql-engine/src/main/scala/org/apache/kyuubi/engine/hive/deploy/HiveYarnModeSubmitter.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* 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.kyuubi.engine.hive.deploy | ||
|
||
import org.apache.kyuubi.Utils | ||
import org.apache.kyuubi.engine.deploy.yarn.EngineYarnModeSubmitter | ||
import org.apache.kyuubi.engine.hive.HiveSQLEngine | ||
import org.apache.kyuubi.util.KyuubiHadoopUtils | ||
|
||
object HiveYarnModeSubmitter extends EngineYarnModeSubmitter { | ||
|
||
def main(args: Array[String]): Unit = { | ||
Utils.fromCommandLineArgs(args, kyuubiConf) | ||
// Initialize the engine submitter. | ||
init() | ||
// Submit the engine application to YARN. | ||
submitApplication() | ||
} | ||
|
||
private def init(): Unit = { | ||
yarnConf = KyuubiHadoopUtils.newYarnConfiguration(kyuubiConf) | ||
hadoopConf = KyuubiHadoopUtils.newHadoopConf(kyuubiConf) | ||
} | ||
|
||
override var engineType: String = "hive" | ||
|
||
override def engineMainClass(): String = HiveSQLEngine.getClass.getName | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...st/scala/org/apache/kyuubi/it/hive/operation/KyuubiOperationHiveEngineYarnModeSuite.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* 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.kyuubi.it.hive.operation | ||
|
||
import org.apache.kyuubi.{HiveEngineTests, Utils, WithKyuubiServerAndHadoopMiniCluster} | ||
import org.apache.kyuubi.config.KyuubiConf | ||
import org.apache.kyuubi.config.KyuubiConf.{ENGINE_IDLE_TIMEOUT, ENGINE_TYPE, KYUUBI_ENGINE_ENV_PREFIX, KYUUBI_HOME} | ||
import org.apache.kyuubi.engine.deploy.YarnMode | ||
|
||
class KyuubiOperationHiveEngineYarnModeSuite extends HiveEngineTests | ||
with WithKyuubiServerAndHadoopMiniCluster { | ||
|
||
override protected val conf: KyuubiConf = { | ||
val metastore = Utils.createTempDir(prefix = getClass.getSimpleName) | ||
metastore.toFile.delete() | ||
KyuubiConf() | ||
.set(s"$KYUUBI_ENGINE_ENV_PREFIX.$KYUUBI_HOME", kyuubiHome) | ||
.set(ENGINE_TYPE, "HIVE_SQL") | ||
.set(KyuubiConf.ENGINE_DEPLOY_MODE, YarnMode.name) | ||
// increase this to 30s as hive session state and metastore client is slow initializing | ||
.setIfMissing(ENGINE_IDLE_TIMEOUT, 30000L) | ||
.set("javax.jdo.option.ConnectionURL", s"jdbc:derby:;databaseName=$metastore;create=true") | ||
} | ||
|
||
override def beforeAll(): Unit = { | ||
super.beforeAll() | ||
conf | ||
.set(KyuubiConf.ENGINE_DEPLOY_YARN_MODE_MEMORY, Math.min(getYarnMaximumAllocationMb, 1024)) | ||
.set(KyuubiConf.ENGINE_DEPLOY_YARN_MODE_MAX_APP_ATTEMPTS, 1) | ||
.set(KyuubiConf.ENGINE_DEPLOY_YARN_MODE_CORES, 1) | ||
} | ||
|
||
override protected def jdbcUrl: String = getJdbcUrl | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
kyuubi-common/src/main/scala/org/apache/kyuubi/engine/deploy/DeployMode.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* 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.kyuubi.engine.deploy | ||
|
||
import java.util.Locale | ||
|
||
import org.apache.kyuubi.Logging | ||
|
||
sealed trait DeployMode { | ||
|
||
/** | ||
* String name of the engine deploy mode. | ||
*/ | ||
def name: String | ||
} | ||
|
||
case object LocalMode extends DeployMode { val name = "local" } | ||
|
||
case object YarnMode extends DeployMode { val name = "yarn" } | ||
|
||
case object KubernetesMode extends DeployMode { val name = "kubernetes" } | ||
|
||
object DeployMode extends Logging { | ||
|
||
/** | ||
* Returns the engine deploy mode from the given string. | ||
*/ | ||
def fromString(mode: String): DeployMode = mode.toLowerCase(Locale.ROOT) match { | ||
case LocalMode.name => LocalMode | ||
case YarnMode.name => YarnMode | ||
case KubernetesMode.name => KubernetesMode | ||
case _ => | ||
warn(s"Unknown deploy mode: $mode, fallback to local mode.") | ||
LocalMode | ||
} | ||
} |
Oops, something went wrong.