You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by fe...@apache.org on 2022/07/15 02:47:58 UTC
[incubator-kyuubi] branch master updated: [KYUUBI #3045][FOLLOWUP] Correct the common options and add docs for kyuubi-admin command
This is an automated email from the ASF dual-hosted git repository.
feiwang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-kyuubi.git
The following commit(s) were added to refs/heads/master by this push:
new 99934591f [KYUUBI #3045][FOLLOWUP] Correct the common options and add docs for kyuubi-admin command
99934591f is described below
commit 99934591f07be5bc8abc1955848e4fc291b8569b
Author: Fei Wang <fw...@ebay.com>
AuthorDate: Fri Jul 15 10:47:49 2022 +0800
[KYUUBI #3045][FOLLOWUP] Correct the common options and add docs for kyuubi-admin command
### _Why are the changes needed?_
1. The version options should be in zkOptions.
2. Add docs for kyuubi-adminctl.
### _How was this patch tested?_
- [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible
- [x] Add screenshots for manual tests if appropriate
![image](https://user-images.githubusercontent.com/6757692/178946106-a5342952-d607-4229-bc7f-a9049d26289d.png)
- [ ] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request
Closes #3066 from turboFei/admin_ctl_docs.
Closes #3045
983d133f [Fei Wang] comments
65675ad7 [Fei Wang] add more
b5b772d5 [Fei Wang] comments
222b409c [Fei Wang] add docs
20c50c00 [Fei Wang] kyuubi-adminctl -> kyuubi-admin
078044e0 [Fei Wang] refactor
4e89b52d [Fei Wang] remove unused
c2d1dc70 [Fei Wang] add admin ctl docs
Authored-by: Fei Wang <fw...@ebay.com>
Signed-off-by: Fei Wang <fw...@ebay.com>
---
bin/{kyuubi-adminctl => kyuubi-admin} | 0
docs/tools/index.rst | 3 +-
docs/tools/kyuubi-admin.rst | 71 ++++++++++++++++++++++
.../scala/org/apache/kyuubi/ctl/CliConfig.scala | 4 +-
.../scala/org/apache/kyuubi/ctl/CommandLine.scala | 12 ++--
.../apache/kyuubi/ctl/ControlCliArguments.scala | 4 +-
.../scala/org/apache/kyuubi/ctl/cmd/Command.scala | 4 +-
.../org/apache/kyuubi/ctl/util/CtlUtils.scala | 2 +-
.../kyuubi/ctl/AdminControlCliArgumentsSuite.scala | 3 +-
.../kyuubi/ctl/ControlCliArgumentsSuite.scala | 10 +--
10 files changed, 92 insertions(+), 21 deletions(-)
diff --git a/bin/kyuubi-adminctl b/bin/kyuubi-admin
similarity index 100%
rename from bin/kyuubi-adminctl
rename to bin/kyuubi-admin
diff --git a/docs/tools/index.rst b/docs/tools/index.rst
index 81e27c06c..079e8617b 100644
--- a/docs/tools/index.rst
+++ b/docs/tools/index.rst
@@ -23,4 +23,5 @@ Tools
:maxdepth: 2
spark_block_cleaner
- kyuubi-ctl
\ No newline at end of file
+ kyuubi-ctl
+ kyuubi-admin
\ No newline at end of file
diff --git a/docs/tools/kyuubi-admin.rst b/docs/tools/kyuubi-admin.rst
new file mode 100644
index 000000000..f822303f9
--- /dev/null
+++ b/docs/tools/kyuubi-admin.rst
@@ -0,0 +1,71 @@
+.. 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.
+
+Kyuubi Administer Tool
+=======================
+
+.. versionadded:: 1.6.0
+
+Kyuubi administer tool(kyuubi-admin) provides administrators with some maintenance operations against a kyuubi server or cluster.
+
+.. _installation:
+
+Installation
+-------------------------------------
+To install kyuubi-admin, you need to unpack the tarball. For example,
+
+.. parsed-literal::
+
+ tar zxf apache-kyuubi-\ |release|\ -bin.tgz
+
+This will result in the creation of a subdirectory named apache-kyuubi-|release|-bin shown below,
+
+.. parsed-literal::
+
+ apache-kyuubi-\ |release|\ -bin
+ ├── ...
+ ├── bin
+ | ├── kyuubi-admin
+ │ ├── ...
+ ├── ...
+
+
+.. _usage:
+
+Usage
+-------------------------------------
+.. code-block:: bash
+
+ bin/kyuubi-admin --help
+
+
+
+.. _refresh_config:
+
+Refresh config
+-------------------------------------
+
+Refresh the config with specified type.
+
+Usage: ``bin/kyuubi-admin refresh config [options] [<configType>]``
+
+.. list-table::
+ :widths: 20 80
+ :header-rows: 1
+
+ * - Config Type
+ - Description
+ * - hadoopConf
+ - The hadoop conf used for proxy user verification.
diff --git a/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/CliConfig.scala b/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/CliConfig.scala
index 873a4b1a1..f2f4aab51 100644
--- a/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/CliConfig.scala
+++ b/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/CliConfig.scala
@@ -42,7 +42,6 @@ case class CliConfig(
conf: Map[String, String] = Map.empty)
case class CommonOpts(
- version: String = null,
verbose: Boolean = false,
hostUrl: String = null,
authSchema: String = null,
@@ -54,7 +53,8 @@ case class ZookeeperOpts(
zkQuorum: String = null,
namespace: String = null,
host: String = null,
- port: String = null)
+ port: String = null,
+ version: String = null)
case class CreateOpts(filename: String = null)
diff --git a/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/CommandLine.scala b/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/CommandLine.scala
index 351e0d28a..56c381848 100644
--- a/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/CommandLine.scala
+++ b/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/CommandLine.scala
@@ -50,7 +50,7 @@ object CommandLine {
def getAdminCtlOptionParser(builder: OParserBuilder[CliConfig]): OParser[Unit, CliConfig] = {
import builder._
OParser.sequence(
- programName("kyuubi-adminctl"),
+ programName("kyuubi-admin"),
head("kyuubi", KYUUBI_VERSION),
common(builder),
refresh(builder),
@@ -68,10 +68,6 @@ object CommandLine {
private def common(builder: OParserBuilder[CliConfig]): OParser[_, CliConfig] = {
import builder._
OParser.sequence(
- opt[String]('v', "version")
- .action((v, c) => c.copy(commonOpts = c.commonOpts.copy(version = v)))
- .text("Using the compiled KYUUBI_VERSION default," +
- " change it if the active service is running in another."),
opt[Unit]('b', "verbose")
.action((_, c) => c.copy(commonOpts = c.commonOpts.copy(verbose = true)))
.text("Print additional debug output."),
@@ -115,7 +111,11 @@ object CommandLine {
.text("Hostname or IP address of a service."),
opt[String]('p', "port")
.action((v, c) => c.copy(zkOpts = c.zkOpts.copy(port = v)))
- .text("Listening port of a service."))
+ .text("Listening port of a service."),
+ opt[String]('v', "version")
+ .action((v, c) => c.copy(zkOpts = c.zkOpts.copy(version = v)))
+ .text("Using the compiled KYUUBI_VERSION default," +
+ " change it if the active service is running in another."))
}
private def create(builder: OParserBuilder[CliConfig]): OParser[_, CliConfig] = {
diff --git a/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/ControlCliArguments.scala b/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/ControlCliArguments.scala
index 6254ba900..0d64ef3eb 100644
--- a/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/ControlCliArguments.scala
+++ b/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/ControlCliArguments.scala
@@ -122,7 +122,7 @@ class ControlCliArguments(args: Seq[String], env: Map[String, String] = sys.env)
| namespace ${cliConfig.zkOpts.namespace}
| host ${cliConfig.zkOpts.host}
| port ${cliConfig.zkOpts.port}
- | version ${cliConfig.commonOpts.version}
+ | version ${cliConfig.zkOpts.version}
| verbose ${cliConfig.commonOpts.verbose}
""".stripMargin
case ControlObject.ENGINE =>
@@ -134,7 +134,7 @@ class ControlCliArguments(args: Seq[String], env: Map[String, String] = sys.env)
| user ${cliConfig.engineOpts.user}
| host ${cliConfig.zkOpts.host}
| port ${cliConfig.zkOpts.port}
- | version ${cliConfig.commonOpts.version}
+ | version ${cliConfig.zkOpts.version}
| verbose ${cliConfig.commonOpts.verbose}
""".stripMargin
case _ => ""
diff --git a/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/cmd/Command.scala b/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/cmd/Command.scala
index f0cdf71e0..6dd88e5e7 100644
--- a/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/cmd/Command.scala
+++ b/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/cmd/Command.scala
@@ -74,11 +74,11 @@ abstract class Command[T](cliConfig: CliConfig) extends Logging {
}
}
- if (arguments.commonOpts.version == null) {
+ if (arguments.zkOpts.version == null) {
if (verbose) {
super.info(s"version is not specified, use built-in KYUUBI_VERSION:$KYUUBI_VERSION")
}
- arguments = arguments.copy(commonOpts = arguments.commonOpts.copy(version = KYUUBI_VERSION))
+ arguments = arguments.copy(zkOpts = arguments.zkOpts.copy(version = KYUUBI_VERSION))
}
arguments
}
diff --git a/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/util/CtlUtils.scala b/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/util/CtlUtils.scala
index dde3c4038..305447993 100644
--- a/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/util/CtlUtils.scala
+++ b/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/util/CtlUtils.scala
@@ -49,7 +49,7 @@ object CtlUtils {
// org.apache.kyuubi.engine.EngineRef#engineSpace
DiscoveryPaths.makePath(
s"${cliConfig.zkOpts.namespace}_" +
- s"${cliConfig.commonOpts.version}_" +
+ s"${cliConfig.zkOpts.version}_" +
s"${engineShareLevel}_${engineType}",
cliConfig.engineOpts.user,
Array(engineSubdomain))
diff --git a/kyuubi-ctl/src/test/scala/org/apache/kyuubi/ctl/AdminControlCliArgumentsSuite.scala b/kyuubi-ctl/src/test/scala/org/apache/kyuubi/ctl/AdminControlCliArgumentsSuite.scala
index 4cf68d226..48f2d6854 100644
--- a/kyuubi-ctl/src/test/scala/org/apache/kyuubi/ctl/AdminControlCliArgumentsSuite.scala
+++ b/kyuubi-ctl/src/test/scala/org/apache/kyuubi/ctl/AdminControlCliArgumentsSuite.scala
@@ -75,9 +75,8 @@ class AdminControlCliArgumentsSuite extends KyuubiFunSuite with TestPrematureExi
// scalastyle:off
val helpString =
s"""kyuubi $KYUUBI_VERSION
- |Usage: kyuubi-adminctl [refresh] [options]
+ |Usage: kyuubi-admin [refresh] [options]
|
- | -v, --version <value> Using the compiled KYUUBI_VERSION default, change it if the active service is running in another.
| -b, --verbose Print additional debug output.
| --hostUrl <value> Host url for rest api.
| --authSchema <value> Auth schema for rest api, valid values are basic, spnego.
diff --git a/kyuubi-ctl/src/test/scala/org/apache/kyuubi/ctl/ControlCliArgumentsSuite.scala b/kyuubi-ctl/src/test/scala/org/apache/kyuubi/ctl/ControlCliArgumentsSuite.scala
index 6241584e9..037f26aa1 100644
--- a/kyuubi-ctl/src/test/scala/org/apache/kyuubi/ctl/ControlCliArgumentsSuite.scala
+++ b/kyuubi-ctl/src/test/scala/org/apache/kyuubi/ctl/ControlCliArgumentsSuite.scala
@@ -82,7 +82,7 @@ class ControlCliArgumentsSuite extends KyuubiFunSuite with TestPrematureExit {
assert(opArgs.cliConfig.zkOpts.namespace == namespace)
assert(opArgs.cliConfig.zkOpts.host == host)
assert(opArgs.cliConfig.zkOpts.port == port)
- assert(opArgs.cliConfig.commonOpts.version == KYUUBI_VERSION)
+ assert(opArgs.cliConfig.zkOpts.version == KYUUBI_VERSION)
if (service == "engine") {
assert(opArgs.cliConfig.engineOpts.user == user)
}
@@ -113,7 +113,7 @@ class ControlCliArgumentsSuite extends KyuubiFunSuite with TestPrematureExit {
assert(opArgs.cliConfig.zkOpts.namespace == newNamespace)
assert(opArgs.cliConfig.zkOpts.host == host)
assert(opArgs.cliConfig.zkOpts.port == port)
- assert(opArgs.cliConfig.commonOpts.version == KYUUBI_VERSION)
+ assert(opArgs.cliConfig.zkOpts.version == KYUUBI_VERSION)
}
}
@@ -296,7 +296,7 @@ class ControlCliArgumentsSuite extends KyuubiFunSuite with TestPrematureExit {
zkQuorum)
val opArgs = new ControlCliArguments(args)
assert(opArgs.cliConfig.zkOpts.namespace == namespace)
- assert(opArgs.cliConfig.commonOpts.version == KYUUBI_VERSION)
+ assert(opArgs.cliConfig.zkOpts.version == KYUUBI_VERSION)
}
test("test use short options") {
@@ -328,7 +328,7 @@ class ControlCliArgumentsSuite extends KyuubiFunSuite with TestPrematureExit {
assert(opArgs.cliConfig.zkOpts.namespace == namespace)
assert(opArgs.cliConfig.zkOpts.host == host)
assert(opArgs.cliConfig.zkOpts.port == port)
- assert(opArgs.cliConfig.commonOpts.version == KYUUBI_VERSION)
+ assert(opArgs.cliConfig.zkOpts.version == KYUUBI_VERSION)
if (service == "engine") {
assert(opArgs.cliConfig.engineOpts.user == user)
}
@@ -357,7 +357,6 @@ class ControlCliArgumentsSuite extends KyuubiFunSuite with TestPrematureExit {
s"""kyuubi $KYUUBI_VERSION
|Usage: kyuubi-ctl [create|get|delete|list|log|submit] [options]
|
- | -v, --version <value> $versionHelpString
| -b, --verbose Print additional debug output.
| --hostUrl <value> Host url for rest api.
| --authSchema <value> Auth schema for rest api, valid values are basic, spnego.
@@ -370,6 +369,7 @@ class ControlCliArgumentsSuite extends KyuubiFunSuite with TestPrematureExit {
| -n, --namespace <value> The namespace, using kyuubi-defaults/conf if absent.
| -s, --host <value> Hostname or IP address of a service.
| -p, --port <value> Listening port of a service.
+ | -v, --version <value> $versionHelpString
|
|Command: create [batch|server] [options]
|${"\t"}Create a resource.