This is an automated email from the ASF dual-hosted git repository.

mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new ead2a2c  Update pulsar-admin functions language (#1497)
ead2a2c is described below

commit ead2a2caaacb35a53b436f46bd39ee3be71024b2
Author: Luc Perkins <lucperk...@gmail.com>
AuthorDate: Wed Apr 4 17:05:41 2018 -0700

    Update pulsar-admin functions language (#1497)
---
 .../org/apache/pulsar/admin/cli/CmdFunctions.java  | 92 +++++++++++-----------
 1 file changed, 46 insertions(+), 46 deletions(-)

diff --git 
a/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdFunctions.java
 
b/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdFunctions.java
index 0bb4098..cfaa4ec 100644
--- 
a/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdFunctions.java
+++ 
b/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdFunctions.java
@@ -66,7 +66,7 @@ import java.util.UUID;
 import org.apache.pulsar.functions.utils.Utils;
 
 @Slf4j
-@Parameters(commandDescription = "Operations for managing Pulsar Functions")
+@Parameters(commandDescription = "Interface for managing Pulsar Functions 
(lightweight, Lambda-style compute processes that work with Pulsar)")
 public class CmdFunctions extends CmdBase {
 
     private final PulsarAdminWithFunctions fnAdmin;
@@ -101,10 +101,10 @@ public class CmdFunctions extends CmdBase {
      */
     @Getter
     abstract class NamespaceCommand extends BaseCommand {
-        @Parameter(names = "--tenant", description = "Tenant name", required = 
true)
+        @Parameter(names = "--tenant", description = "The function's tenant", 
required = true)
         protected String tenant;
 
-        @Parameter(names = "--namespace", description = "Namespace name", 
required = true)
+        @Parameter(names = "--namespace", description = "The function's 
namespace", required = true)
         protected String namespace;
     }
 
@@ -113,7 +113,7 @@ public class CmdFunctions extends CmdBase {
      */
     @Getter
     abstract class FunctionCommand extends NamespaceCommand {
-        @Parameter(names = "--name", description = "Function name", required = 
true)
+        @Parameter(names = "--name", description = "The function's name", 
required = true)
         protected String functionName;
     }
 
@@ -122,39 +122,39 @@ public class CmdFunctions extends CmdBase {
      */
     @Getter
     abstract class FunctionConfigCommand extends BaseCommand {
-        @Parameter(names = "--tenant", description = "Tenant name")
+        @Parameter(names = "--tenant", description = "The function's tenant")
         protected String tenant;
-        @Parameter(names = "--namespace", description = "Namespace name")
+        @Parameter(names = "--namespace", description = "The function's 
namespace")
         protected String namespace;
-        @Parameter(names = "--name", description = "Function name")
+        @Parameter(names = "--name", description = "The function's name")
         protected String functionName;
-        @Parameter(names = "--className", description = "Function class name", 
required = true)
+        @Parameter(names = "--className", description = "The function's class 
name", required = true)
         protected String className;
         @Parameter(
                 names = "--jar",
-                description = "Path to the Java JAR file",
+                description = "Path to the jar file for the function (if the 
function is written in Java)",
                 listConverter = StringConverter.class)
         protected String jarFile;
         @Parameter(
                 names = "--py",
-                description = "Path to the main Python file",
+                description = "Path to the main Python file for the function 
(if the function is written in Python)",
                 listConverter = StringConverter.class)
         protected String pyFile;
-        @Parameter(names = "--inputs", description = "Input topic name")
+        @Parameter(names = "--inputs", description = "The function's input 
topic or topics (multiple topics can be specified as a comma-separated list)")
         protected String inputs;
-        @Parameter(names = "--output", description = "Output topic name")
+        @Parameter(names = "--output", description = "The function's output 
topic")
         protected String output;
-        @Parameter(names = "--logTopic", description = "Log topic")
+        @Parameter(names = "--logTopic", description = "The topic to which the 
function's logs are produced")
         protected String logTopic;
-        @Parameter(names = "--customSerdeInputs", description = "Map of input 
topic to SerDe class name")
+        @Parameter(names = "--customSerdeInputs", description = "The map of 
input topics to SerDe class names (as a JSON string)")
         protected String customSerdeInputString;
-        @Parameter(names = "--outputSerdeClassName", description = "Output 
SerDe")
+        @Parameter(names = "--outputSerdeClassName", description = "The SerDe 
class to be used for messages output by the function")
         protected String outputSerdeClassName;
-        @Parameter(names = "--functionConfigFile", description = "Path to a 
YAML config file for the function")
+        @Parameter(names = "--functionConfigFile", description = "The path to 
a YAML config file specifying the function's configuration")
         protected String fnConfigFile;
-        @Parameter(names = "--processingGuarantees", description = "Processing 
guarantees applied to the function")
+        @Parameter(names = "--processingGuarantees", description = "The 
processing guarantees (aka delivery semantics) applied to the function")
         protected FunctionConfig.ProcessingGuarantees processingGuarantees;
-        @Parameter(names = "--subscriptionType", description = "The type of 
subscription used by the function as a consumer")
+        @Parameter(names = "--subscriptionType", description = "The type of 
subscription used by the function when consuming messages from the input 
topic(s)")
         protected FunctionConfig.SubscriptionType subscriptionType;
         @Parameter(names = "--userConfig", description = "User-defined config 
key/values")
         protected String userConfigString;
@@ -225,11 +225,11 @@ public class CmdFunctions extends CmdBase {
                 
functionConfigBuilder.setRuntime(FunctionConfig.Runtime.PYTHON);
                 userCodeFile = pyFile;
             } else {
-                throw new RuntimeException("Either jar name or python file 
need to be specified");
+                throw new RuntimeException("Either a Java jar or a Python file 
needs to be specified for the function");
             }
 
             if (functionConfigBuilder.getInputsCount() == 0 && 
functionConfigBuilder.getCustomSerdeInputsCount() == 0) {
-                throw new RuntimeException("No input topics specified");
+                throw new RuntimeException("No input topic(s) specified for 
the function");
             }
 
             if (parallelism == null) {
@@ -239,7 +239,7 @@ public class CmdFunctions extends CmdBase {
             } else {
                 int num = Integer.parseInt(parallelism);
                 if (num <= 0) {
-                    throw new IllegalArgumentException("Parallelism must be 
positive");
+                    throw new IllegalArgumentException("The parallelism factor 
(the number of instances) for the function must be positive");
                 }
                 functionConfigBuilder.setParallelism(num);
             }
@@ -257,7 +257,7 @@ public class CmdFunctions extends CmdBase {
                         functionConfigBuilder.getClassName(), jarFile));
             } else if (!Reflections.classInJarImplementsIface(file, 
functionConfigBuilder.getClassName(), Function.class)
                     && !Reflections.classInJarImplementsIface(file, 
functionConfigBuilder.getClassName(), java.util.function.Function.class)) {
-                throw new IllegalArgumentException(String.format("Pulsar 
function class %s in jar %s implements neither 
org.apache.pulsar.functions.api.Function nor java.util.function.Function",
+                throw new IllegalArgumentException(String.format("The Pulsar 
function class %s in jar %s implements neither 
org.apache.pulsar.functions.api.Function nor java.util.function.Function",
                         functionConfigBuilder.getClassName(), jarFile));
             }
 
@@ -273,14 +273,14 @@ public class CmdFunctions extends CmdBase {
             if (userClass instanceof Function) {
                 Function pulsarFunction = (Function) userClass;
                 if (pulsarFunction == null) {
-                    throw new IllegalArgumentException(String.format("Pulsar 
function class %s could not be instantiated from jar %s",
+                    throw new IllegalArgumentException(String.format("The 
Pulsar function class %s could not be instantiated from jar %s",
                             functionConfigBuilder.getClassName(), jarFile));
                 }
                 typeArgs = TypeResolver.resolveRawArguments(Function.class, 
pulsarFunction.getClass());
             } else {
                 java.util.function.Function function = 
(java.util.function.Function) userClass;
                 if (function == null) {
-                    throw new IllegalArgumentException(String.format("Java 
Util function class %s could not be instantiated from jar %s",
+                    throw new IllegalArgumentException(String.format("The Java 
util function class %s could not be instantiated from jar %s",
                             functionConfigBuilder.getClassName(), jarFile));
                 }
                 typeArgs = 
TypeResolver.resolveRawArguments(java.util.function.Function.class, 
function.getClass());
@@ -292,27 +292,27 @@ public class CmdFunctions extends CmdBase {
                 if (!Reflections.classExists(inputSerializer)
                         && !Reflections.classExistsInJar(new File(jarFile), 
inputSerializer)) {
                     throw new IllegalArgumentException(
-                            String.format("Input serialization/deserialization 
class %s does not exist",
+                            String.format("The input 
serialization/deserialization class %s does not exist",
                                     inputSerializer));
                 } else if (Reflections.classExists(inputSerializer)) {
                     if (!Reflections.classImplementsIface(inputSerializer, 
SerDe.class)) {
-                        throw new 
IllegalArgumentException(String.format("Input serialization/deserialization 
class %s does not not implement %s",
+                        throw new IllegalArgumentException(String.format("The 
input serialization/deserialization class %s does not not implement %s",
                                 inputSerializer, 
SerDe.class.getCanonicalName()));
                     }
                 } else if (Reflections.classExistsInJar(new File(jarFile), 
inputSerializer)) {
                     if (!Reflections.classInJarImplementsIface(new 
File(jarFile), inputSerializer, SerDe.class)) {
-                        throw new 
IllegalArgumentException(String.format("Input serialization/deserialization 
class %s does not not implement %s",
+                        throw new IllegalArgumentException(String.format("The 
input serialization/deserialization class %s does not not implement %s",
                                 inputSerializer, 
SerDe.class.getCanonicalName()));
                     }
                 }
                 if (inputSerializer.equals(DefaultSerDe.class.getName())) {
                     if (!DefaultSerDe.IsSupportedType(typeArgs[0])) {
-                        throw new RuntimeException("Default Serializer does 
not support type " + typeArgs[0]);
+                        throw new RuntimeException("The default Serializer 
does not support type " + typeArgs[0]);
                     }
                 } else {
                     SerDe serDe = (SerDe) 
Reflections.createInstance(inputSerializer, file);
                     if (serDe == null) {
-                        throw new 
IllegalArgumentException(String.format("SerDe class %s does not exist in jar 
%s",
+                        throw new IllegalArgumentException(String.format("The 
SerDe class %s does not exist in jar %s",
                                 inputSerializer, jarFile));
                     }
                     Class<?>[] serDeTypes = 
TypeResolver.resolveRawArguments(SerDe.class, serDe.getClass());
@@ -373,7 +373,7 @@ public class CmdFunctions extends CmdBase {
 
         private void doPythonSubmitChecks(FunctionConfig.Builder 
functionConfigBuilder) {
             if (functionConfigBuilder.getProcessingGuarantees() == 
FunctionConfig.ProcessingGuarantees.EFFECTIVELY_ONCE) {
-                throw new RuntimeException("Effectively once not yet supported 
in python");
+                throw new RuntimeException("Effectively-once processing 
guarantees not yet supported in Python");
             }
         }
 
@@ -406,7 +406,7 @@ public class CmdFunctions extends CmdBase {
                 String inputTopic = getUniqueInput(builder);
                 builder.setTenant(TopicName.get(inputTopic).getProperty());
             } catch (IllegalArgumentException ex) {
-                throw new RuntimeException("Missing tenant", ex);
+                throw new RuntimeException("You need to specify a tenant for 
the function", ex);
             }
         }
 
@@ -415,7 +415,7 @@ public class CmdFunctions extends CmdBase {
                 String inputTopic = getUniqueInput(builder);
                 
builder.setNamespace(TopicName.get(inputTopic).getNamespacePortion());
             } catch (IllegalArgumentException ex) {
-                throw new RuntimeException("Missing Namespace");
+                throw new RuntimeException("You need to specify a namespace 
for the function");
             }
         }
 
@@ -441,14 +441,14 @@ public class CmdFunctions extends CmdBase {
         }
     }
 
-    @Parameters(commandDescription = "Run function locally")
+    @Parameters(commandDescription = "Run the Pulsar Function locally (rather 
than deploying it to the Pulsar cluster)")
     class LocalRunner extends FunctionConfigCommand {
 
         // TODO: this should become bookkeeper url and it should be fetched 
from pulsar client.
-        @Parameter(names = "--stateStorageServiceUrl", description = "State 
storage service URL")
+        @Parameter(names = "--stateStorageServiceUrl", description = "The URL 
for the state storage service (by default Apache BookKeeper)")
         protected String stateStorageServiceUrl;
 
-        @Parameter(names = "--brokerServiceUrl", description = "The Pulsar 
broker URL")
+        @Parameter(names = "--brokerServiceUrl", description = "The URL for 
the Pulsar broker")
         protected String brokerServiceUrl;
 
         @Override
@@ -500,7 +500,7 @@ public class CmdFunctions extends CmdBase {
         }
     }
 
-    @Parameters(commandDescription = "Create function")
+    @Parameters(commandDescription = "Create a Pulsar Function in cluster mode 
(i.e. deploy it on a Pulsar cluster)")
     class CreateFunction extends FunctionConfigCommand {
         @Override
         void runCmd() throws Exception {
@@ -512,7 +512,7 @@ public class CmdFunctions extends CmdBase {
         }
     }
 
-    @Parameters(commandDescription = "Get function")
+    @Parameters(commandDescription = "Fetch information about a Pulsar 
Function")
     class GetFunction extends FunctionCommand {
         @Override
         void runCmd() throws Exception {
@@ -522,7 +522,7 @@ public class CmdFunctions extends CmdBase {
         }
     }
 
-    @Parameters(commandDescription = "GetStatus function")
+    @Parameters(commandDescription = "Check the current status of a Pulsar 
Function")
     class GetFunctionStatus extends FunctionCommand {
         @Override
         void runCmd() throws Exception {
@@ -532,7 +532,7 @@ public class CmdFunctions extends CmdBase {
         }
     }
 
-    @Parameters(commandDescription = "Delete function")
+    @Parameters(commandDescription = "Delete a Pulsar Function that's running 
on a Pulsar cluster")
     class DeleteFunction extends FunctionCommand {
         @Override
         void runCmd() throws Exception {
@@ -541,7 +541,7 @@ public class CmdFunctions extends CmdBase {
         }
     }
 
-    @Parameters(commandDescription = "Update function")
+    @Parameters(commandDescription = "Update a Pulsar Function that's been 
deployed to a Pulsar cluster")
     class UpdateFunction extends FunctionConfigCommand {
         @Override
         void runCmd() throws Exception {
@@ -553,7 +553,7 @@ public class CmdFunctions extends CmdBase {
         }
     }
 
-    @Parameters(commandDescription = "List function")
+    @Parameters(commandDescription = "List all of the Pulsar Functions running 
under a specific tenant and namespace")
     class ListFunctions extends NamespaceCommand {
         @Override
         void runCmd() throws Exception {
@@ -561,22 +561,22 @@ public class CmdFunctions extends CmdBase {
         }
     }
 
-    @Parameters(commandDescription = "Query Function State")
+    @Parameters(commandDescription = "Fetch the current state associated with 
a Pulsar Function running in cluster mode")
     class StateGetter extends FunctionCommand {
 
         @Parameter(names = { "-k", "--key" }, description = "key")
         private String key = null;
 
         // TODO: this url should be fetched along with bookkeeper location 
from pulsar admin
-        @Parameter(names = { "-u", "--storage-service-url" }, description = 
"storage service url")
+        @Parameter(names = { "-u", "--storage-service-url" }, description = 
"The URL for the storage service used by the function")
         private String stateStorageServiceUrl = null;
 
-        @Parameter(names = { "-w", "--watch" }, description = "watch the value 
changes of a key")
+        @Parameter(names = { "-w", "--watch" }, description = "Watch for 
changes in the value associated with a key for a Pulsar Function")
         private boolean watch = false;
 
         @Override
         void runCmd() throws Exception {
-            checkNotNull(stateStorageServiceUrl, "State storage service url is 
missing");
+            checkNotNull(stateStorageServiceUrl, "The state storage service 
URL is missing");
 
             String tableNs = String.format(
                 "%s_%s",
@@ -628,7 +628,7 @@ public class CmdFunctions extends CmdBase {
         @Override
         void runCmd() throws Exception {
             if (triggerFile == null && triggerValue == null) {
-                throw new RuntimeException("Either a trigger value or a 
trigger filepath needs to be present");
+                throw new RuntimeException("Either a trigger value or a 
trigger filepath needs to be specified");
             }
             String retval = fnAdmin.functions().triggerFunction(tenant, 
namespace, functionName, triggerValue, triggerFile);
             System.out.println(retval);

-- 
To stop receiving notification emails like this one, please contact
mme...@apache.org.

Reply via email to