[ https://issues.apache.org/jira/browse/FLINK-8135?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16579382#comment-16579382 ]
ASF GitHub Bot commented on FLINK-8135: --------------------------------------- zentol closed pull request #5985: [FLINK-8135][REST][docs] Add description to MessageParameter URL: https://github.com/apache/flink/pull/5985 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/docs/_includes/generated/rest_dispatcher.html b/docs/_includes/generated/rest_dispatcher.html index ab0f4e0a0a4..845dd8bebdf 100644 --- a/docs/_includes/generated/rest_dispatcher.html +++ b/docs/_includes/generated/rest_dispatcher.html @@ -234,7 +234,7 @@ <tr> <td colspan="2"> <ul> -<li><code>jarid</code> - description</li> +<li><code>jarid</code> - String value that identifies a jar. When uploading the jar a path is returned, where the filename is the ID. This value is equivalent to the `id` field in the list of uploaded jars (/jars).</li> </ul> </td> </tr> @@ -280,7 +280,7 @@ <tr> <td colspan="2"> <ul> -<li><code>jarid</code> - description</li> +<li><code>jarid</code> - String value that identifies a jar. When uploading the jar a path is returned, where the filename is the ID. This value is equivalent to the `id` field in the list of uploaded jars (/jars).</li> </ul> </td> </tr> @@ -290,9 +290,9 @@ <tr> <td colspan="2"> <ul> -<li><code>entry-class</code> (optional): description</li> -<li><code>parallelism</code> (optional): description</li> -<li><code>program-args</code> (optional): description</li> +<li><code>entry-class</code> (optional): String value that specifies the fully qualified name of the entry point class. Overrides the class defined in the jar file manifest.</li> +<li><code>parallelism</code> (optional): Positive integer value that specifies the desired parallelism for the job.</li> +<li><code>program-args</code> (optional): String value that specifies the arguments for the program or plan.</li> </ul> </td> </tr> @@ -314,7 +314,13 @@ <pre> <code> { - "type" : "any" + "type" : "object", + "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:JobPlanInfo", + "properties" : { + "plan" : { + "type" : "any" + } + } } </code> </pre> </div> @@ -340,7 +346,7 @@ <tr> <td colspan="2"> <ul> -<li><code>jarid</code> - description</li> +<li><code>jarid</code> - String value that identifies a jar. When uploading the jar a path is returned, where the filename is the ID. This value is equivalent to the `id` field in the list of uploaded jars (/jars).</li> </ul> </td> </tr> @@ -350,11 +356,11 @@ <tr> <td colspan="2"> <ul> -<li><code>program-args</code> (optional): description</li> -<li><code>entry-class</code> (optional): description</li> -<li><code>parallelism</code> (optional): description</li> -<li><code>allowNonRestoredState</code> (optional): description</li> -<li><code>savepointPath</code> (optional): description</li> +<li><code>program-args</code> (optional): String value that specifies the arguments for the program or plan.</li> +<li><code>entry-class</code> (optional): String value that specifies the fully qualified name of the entry point class. Overrides the class defined in the jar file manifest.</li> +<li><code>parallelism</code> (optional): Positive integer value that specifies the desired parallelism for the job.</li> +<li><code>allowNonRestoredState</code> (optional): Boolean value that specifies whether the job submission should be rejected if the savepoint contains state that cannot be mapped back to the job.</li> +<li><code>savepointPath</code> (optional): String value that specifies the path of the savepoint to restore the job from.</li> </ul> </td> </tr> @@ -478,7 +484,7 @@ <tr> <td colspan="2"> <ul> -<li><code>get</code> (optional): description</li> +<li><code>get</code> (optional): Comma-separated list of string values to select specific metrics.</li> </ul> </td> </tr> @@ -575,7 +581,7 @@ <td class="text-left">Response code: <code>202 Accepted</code></td> </tr> <tr> - <td colspan="2">Submits a job. This call is primarily intended to be used by the Flink client. This call expects amultipart/form-data request that consists of file uploads for the serialized JobGraph, jars anddistributed cache artifacts and an attribute named "request"for the JSON payload.</td> + <td colspan="2">Submits a job. This call is primarily intended to be used by the Flink client. This call expects a multipart/form-data request that consists of file uploads for the serialized JobGraph, jars and distributed cache artifacts and an attribute named "request" for the JSON payload.</td> </tr> <tr> <td colspan="2"> @@ -656,9 +662,9 @@ <tr> <td colspan="2"> <ul> -<li><code>get</code> (optional): description</li> -<li><code>agg</code> (optional): description</li> -<li><code>jobs</code> (optional): description</li> +<li><code>get</code> (optional): Comma-separated list of string values to select specific metrics.</li> +<li><code>agg</code> (optional): Comma-separated list of aggregation modes which should be calculated. Available aggregations are: "min, max, sum, avg".</li> +<li><code>jobs</code> (optional): Comma-separated list of 32-character hexadecimal strings to select specific jobs.</li> </ul> </td> </tr> @@ -753,7 +759,7 @@ <tr> <td colspan="2"> <ul> -<li><code>jobid</code> - description</li> +<li><code>jobid</code> - 32-character hexadecimal string value that identifies a job.</li> </ul> </td> </tr> @@ -911,7 +917,7 @@ <tr> <td colspan="2"> <ul> -<li><code>jobid</code> - description</li> +<li><code>jobid</code> - 32-character hexadecimal string value that identifies a job.</li> </ul> </td> </tr> @@ -921,7 +927,7 @@ <tr> <td colspan="2"> <ul> -<li><code>mode</code> (optional): description</li> +<li><code>mode</code> (optional): String value that specifies the termination mode. Supported values are: "cancel, stop".</li> </ul> </td> </tr> @@ -967,7 +973,7 @@ <tr> <td colspan="2"> <ul> -<li><code>jobid</code> - description</li> +<li><code>jobid</code> - 32-character hexadecimal string value that identifies a job.</li> </ul> </td> </tr> @@ -977,7 +983,7 @@ <tr> <td colspan="2"> <ul> -<li><code>includeSerializedValue</code> (optional): description</li> +<li><code>includeSerializedValue</code> (optional): Boolean value that specifies whether serialized user task accumulators should be included in the response.</li> </ul> </td> </tr> @@ -1058,7 +1064,7 @@ <tr> <td colspan="2"> <ul> -<li><code>jobid</code> - description</li> +<li><code>jobid</code> - 32-character hexadecimal string value that identifies a job.</li> </ul> </td> </tr> @@ -1361,7 +1367,7 @@ <tr> <td colspan="2"> <ul> -<li><code>jobid</code> - description</li> +<li><code>jobid</code> - 32-character hexadecimal string value that identifies a job.</li> </ul> </td> </tr> @@ -1439,8 +1445,8 @@ <tr> <td colspan="2"> <ul> -<li><code>jobid</code> - description</li> -<li><code>checkpointid</code> - description</li> +<li><code>jobid</code> - 32-character hexadecimal string value that identifies a job.</li> +<li><code>checkpointid</code> - Long value that identifies a checkpoint.</li> </ul> </td> </tr> @@ -1556,9 +1562,9 @@ <tr> <td colspan="2"> <ul> -<li><code>jobid</code> - description</li> -<li><code>checkpointid</code> - description</li> -<li><code>vertexid</code> - description</li> +<li><code>jobid</code> - 32-character hexadecimal string value that identifies a job.</li> +<li><code>checkpointid</code> - Long value that identifies a checkpoint.</li> +<li><code>vertexid</code> - 32-character hexadecimal string value that identifies a job vertex.</li> </ul> </td> </tr> @@ -1702,7 +1708,7 @@ <tr> <td colspan="2"> <ul> -<li><code>jobid</code> - description</li> +<li><code>jobid</code> - 32-character hexadecimal string value that identifies a job.</li> </ul> </td> </tr> @@ -1750,7 +1756,7 @@ <tr> <td colspan="2"> <ul> -<li><code>jobid</code> - description</li> +<li><code>jobid</code> - 32-character hexadecimal string value that identifies a job.</li> </ul> </td> </tr> @@ -1831,7 +1837,7 @@ <tr> <td colspan="2"> <ul> -<li><code>jobid</code> - description</li> +<li><code>jobid</code> - 32-character hexadecimal string value that identifies a job.</li> </ul> </td> </tr> @@ -1897,7 +1903,7 @@ <tr> <td colspan="2"> <ul> -<li><code>jobid</code> - description</li> +<li><code>jobid</code> - 32-character hexadecimal string value that identifies a job.</li> </ul> </td> </tr> @@ -1907,7 +1913,7 @@ <tr> <td colspan="2"> <ul> -<li><code>get</code> (optional): description</li> +<li><code>get</code> (optional): Comma-separated list of string values to select specific metrics.</li> </ul> </td> </tr> @@ -1955,7 +1961,7 @@ <tr> <td colspan="2"> <ul> -<li><code>jobid</code> - description</li> +<li><code>jobid</code> - 32-character hexadecimal string value that identifies a job.</li> </ul> </td> </tr> @@ -1977,7 +1983,13 @@ <pre> <code> { - "type" : "any" + "type" : "object", + "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:JobPlanInfo", + "properties" : { + "plan" : { + "type" : "any" + } + } } </code> </pre> </div> @@ -2003,7 +2015,7 @@ <tr> <td colspan="2"> <ul> -<li><code>jobid</code> - description</li> +<li><code>jobid</code> - 32-character hexadecimal string value that identifies a job.</li> </ul> </td> </tr> @@ -2013,7 +2025,7 @@ <tr> <td colspan="2"> <ul> -<li><code>parallelism</code> (mandatory): description</li> +<li><code>parallelism</code> (mandatory): Positive integer value that specifies the desired parallelism.</li> </ul> </td> </tr> @@ -2067,8 +2079,8 @@ <tr> <td colspan="2"> <ul> -<li><code>jobid</code> - description</li> -<li><code>triggerid</code> - description</li> +<li><code>jobid</code> - 32-character hexadecimal string value that identifies a job.</li> +<li><code>triggerid</code> - 32-character hexadecimal string that identifies an asynchronous operation trigger ID. The ID was returned then the operation was triggered.</li> </ul> </td> </tr> @@ -2133,7 +2145,7 @@ <tr> <td colspan="2"> <ul> -<li><code>jobid</code> - description</li> +<li><code>jobid</code> - 32-character hexadecimal string value that identifies a job.</li> </ul> </td> </tr> @@ -2198,8 +2210,8 @@ <tr> <td colspan="2"> <ul> -<li><code>jobid</code> - description</li> -<li><code>triggerid</code> - description</li> +<li><code>jobid</code> - 32-character hexadecimal string value that identifies a job.</li> +<li><code>triggerid</code> - 32-character hexadecimal string that identifies an asynchronous operation trigger ID. The ID was returned then the operation was triggered.</li> </ul> </td> </tr> @@ -2264,8 +2276,8 @@ <tr> <td colspan="2"> <ul> -<li><code>jobid</code> - description</li> -<li><code>vertexid</code> - description</li> +<li><code>jobid</code> - 32-character hexadecimal string value that identifies a job.</li> +<li><code>vertexid</code> - 32-character hexadecimal string value that identifies a job vertex.</li> </ul> </td> </tr> @@ -2389,8 +2401,8 @@ <tr> <td colspan="2"> <ul> -<li><code>jobid</code> - description</li> -<li><code>vertexid</code> - description</li> +<li><code>jobid</code> - 32-character hexadecimal string value that identifies a job.</li> +<li><code>vertexid</code> - 32-character hexadecimal string value that identifies a job vertex.</li> </ul> </td> </tr> @@ -2462,8 +2474,8 @@ <tr> <td colspan="2"> <ul> -<li><code>jobid</code> - description</li> -<li><code>vertexid</code> - description</li> +<li><code>jobid</code> - 32-character hexadecimal string value that identifies a job.</li> +<li><code>vertexid</code> - 32-character hexadecimal string value that identifies a job vertex.</li> </ul> </td> </tr> @@ -2544,8 +2556,8 @@ <tr> <td colspan="2"> <ul> -<li><code>jobid</code> - description</li> -<li><code>vertexid</code> - description</li> +<li><code>jobid</code> - 32-character hexadecimal string value that identifies a job.</li> +<li><code>vertexid</code> - 32-character hexadecimal string value that identifies a job vertex.</li> </ul> </td> </tr> @@ -2555,7 +2567,7 @@ <tr> <td colspan="2"> <ul> -<li><code>get</code> (optional): description</li> +<li><code>get</code> (optional): Comma-separated list of string values to select specific metrics.</li> </ul> </td> </tr> @@ -2603,8 +2615,8 @@ <tr> <td colspan="2"> <ul> -<li><code>jobid</code> - description</li> -<li><code>vertexid</code> - description</li> +<li><code>jobid</code> - 32-character hexadecimal string value that identifies a job.</li> +<li><code>vertexid</code> - 32-character hexadecimal string value that identifies a job vertex.</li> </ul> </td> </tr> @@ -2697,8 +2709,8 @@ <tr> <td colspan="2"> <ul> -<li><code>jobid</code> - description</li> -<li><code>vertexid</code> - description</li> +<li><code>jobid</code> - 32-character hexadecimal string value that identifies a job.</li> +<li><code>vertexid</code> - 32-character hexadecimal string value that identifies a job vertex.</li> </ul> </td> </tr> @@ -2708,9 +2720,9 @@ <tr> <td colspan="2"> <ul> -<li><code>get</code> (optional): description</li> -<li><code>agg</code> (optional): description</li> -<li><code>subtasks</code> (optional): description</li> +<li><code>get</code> (optional): Comma-separated list of string values to select specific metrics.</li> +<li><code>agg</code> (optional): Comma-separated list of aggregation modes which should be calculated. Available aggregations are: "min, max, sum, avg".</li> +<li><code>subtasks</code> (optional): Comma-separated list of integer ranges (e.g. "1,3,5-9") to select specific subtasks.</li> </ul> </td> </tr> @@ -2758,9 +2770,9 @@ <tr> <td colspan="2"> <ul> -<li><code>jobid</code> - description</li> -<li><code>vertexid</code> - description</li> -<li><code>subtaskindex</code> - description</li> +<li><code>jobid</code> - 32-character hexadecimal string value that identifies a job.</li> +<li><code>vertexid</code> - 32-character hexadecimal string value that identifies a job vertex.</li> +<li><code>subtaskindex</code> - Positive integer value that identifies a subtask.</li> </ul> </td> </tr> @@ -2863,10 +2875,10 @@ <tr> <td colspan="2"> <ul> -<li><code>jobid</code> - description</li> -<li><code>vertexid</code> - description</li> -<li><code>subtaskindex</code> - description</li> -<li><code>attempt</code> - description</li> +<li><code>jobid</code> - 32-character hexadecimal string value that identifies a job.</li> +<li><code>vertexid</code> - 32-character hexadecimal string value that identifies a job vertex.</li> +<li><code>subtaskindex</code> - Positive integer value that identifies a subtask.</li> +<li><code>attempt</code> - Positive integer value that identifies an execution attempt.</li> </ul> </td> </tr> @@ -2969,10 +2981,10 @@ <tr> <td colspan="2"> <ul> -<li><code>jobid</code> - description</li> -<li><code>vertexid</code> - description</li> -<li><code>subtaskindex</code> - description</li> -<li><code>attempt</code> - description</li> +<li><code>jobid</code> - 32-character hexadecimal string value that identifies a job.</li> +<li><code>vertexid</code> - 32-character hexadecimal string value that identifies a job vertex.</li> +<li><code>subtaskindex</code> - Positive integer value that identifies a subtask.</li> +<li><code>attempt</code> - Positive integer value that identifies an execution attempt.</li> </ul> </td> </tr> @@ -3050,9 +3062,9 @@ <tr> <td colspan="2"> <ul> -<li><code>jobid</code> - description</li> -<li><code>vertexid</code> - description</li> -<li><code>subtaskindex</code> - description</li> +<li><code>jobid</code> - 32-character hexadecimal string value that identifies a job.</li> +<li><code>vertexid</code> - 32-character hexadecimal string value that identifies a job vertex.</li> +<li><code>subtaskindex</code> - Positive integer value that identifies a subtask.</li> </ul> </td> </tr> @@ -3062,7 +3074,7 @@ <tr> <td colspan="2"> <ul> -<li><code>get</code> (optional): description</li> +<li><code>get</code> (optional): Comma-separated list of string values to select specific metrics.</li> </ul> </td> </tr> @@ -3110,8 +3122,8 @@ <tr> <td colspan="2"> <ul> -<li><code>jobid</code> - description</li> -<li><code>vertexid</code> - description</li> +<li><code>jobid</code> - 32-character hexadecimal string value that identifies a job.</li> +<li><code>vertexid</code> - 32-character hexadecimal string value that identifies a job vertex.</li> </ul> </td> </tr> @@ -3195,8 +3207,8 @@ <tr> <td colspan="2"> <ul> -<li><code>jobid</code> - description</li> -<li><code>vertexid</code> - description</li> +<li><code>jobid</code> - 32-character hexadecimal string value that identifies a job.</li> +<li><code>vertexid</code> - 32-character hexadecimal string value that identifies a job vertex.</li> </ul> </td> </tr> @@ -3437,7 +3449,7 @@ <tr> <td colspan="2"> <ul> -<li><code>triggerid</code> - description</li> +<li><code>triggerid</code> - 32-character hexadecimal string that identifies an asynchronous operation trigger ID. The ID was returned then the operation was triggered.</li> </ul> </td> </tr> @@ -3588,9 +3600,9 @@ <tr> <td colspan="2"> <ul> -<li><code>get</code> (optional): description</li> -<li><code>agg</code> (optional): description</li> -<li><code>taskmanagers</code> (optional): description</li> +<li><code>get</code> (optional): Comma-separated list of string values to select specific metrics.</li> +<li><code>agg</code> (optional): Comma-separated list of aggregation modes which should be calculated. Available aggregations are: "min, max, sum, avg".</li> +<li><code>taskmanagers</code> (optional): Comma-separated list of 32-character hexadecimal strings to select specific task managers.</li> </ul> </td> </tr> @@ -3638,7 +3650,7 @@ <tr> <td colspan="2"> <ul> -<li><code>taskmanagerid</code> - description</li> +<li><code>taskmanagerid</code> - 32-character hexadecimal string that identifies a task manager.</li> </ul> </td> </tr> @@ -3791,7 +3803,7 @@ <tr> <td colspan="2"> <ul> -<li><code>taskmanagerid</code> - description</li> +<li><code>taskmanagerid</code> - 32-character hexadecimal string that identifies a task manager.</li> </ul> </td> </tr> @@ -3801,7 +3813,7 @@ <tr> <td colspan="2"> <ul> -<li><code>get</code> (optional): description</li> +<li><code>get</code> (optional): Comma-separated list of string values to select specific metrics.</li> </ul> </td> </tr> diff --git a/flink-core/src/main/java/org/apache/flink/util/StringUtils.java b/flink-core/src/main/java/org/apache/flink/util/StringUtils.java index 208a30114d5..b9ff319f7b3 100644 --- a/flink-core/src/main/java/org/apache/flink/util/StringUtils.java +++ b/flink-core/src/main/java/org/apache/flink/util/StringUtils.java @@ -28,7 +28,9 @@ import java.io.IOException; import java.util.Arrays; +import java.util.Objects; import java.util.Random; +import java.util.stream.Collectors; import static org.apache.flink.util.Preconditions.checkNotNull; @@ -348,6 +350,21 @@ public static String concatenateWithAnd(@Nullable String s1, @Nullable String s2 } } + /** + * Generates a string containing a comma-separated list of values in double-quotes. + * Uses lower-cased values returned from {@link Object#toString()} method for each element in the given array. + * Null values are skipped. + * + * @param values array of elements for the list + * + * @return The string with quoted list of elements + */ + public static String toQuotedListString(Object[] values) { + return Arrays.stream(values).filter(Objects::nonNull) + .map(v -> v.toString().toLowerCase()) + .collect(Collectors.joining(", ", "\"", "\"")); + } + // ------------------------------------------------------------------------ /** Prevent instantiation of this utility class. */ diff --git a/flink-docs/src/main/java/org/apache/flink/docs/rest/RestAPIDocGenerator.java b/flink-docs/src/main/java/org/apache/flink/docs/rest/RestAPIDocGenerator.java index cebde56a898..2c8d187393a 100644 --- a/flink-docs/src/main/java/org/apache/flink/docs/rest/RestAPIDocGenerator.java +++ b/flink-docs/src/main/java/org/apache/flink/docs/rest/RestAPIDocGenerator.java @@ -226,7 +226,7 @@ private static String createPathParameterHtmlList(Collection<MessagePathParamete pathParameterList.append( String.format("<li><code>%s</code> - %s</li>\n", messagePathParameter.getKey(), - "description") + messagePathParameter.getDescription()) )); return pathParameterList.toString(); } @@ -240,7 +240,7 @@ private static String createQueryParameterHtmlList(Collection<MessageQueryParame String.format("<li><code>%s</code> (%s): %s</li>\n", parameter.getKey(), parameter.isMandatory() ? "mandatory" : "optional", - "description") + parameter.getDescription()) )); return queryParameterList.toString(); } diff --git a/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/AllowNonRestoredStateQueryParameter.java b/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/AllowNonRestoredStateQueryParameter.java index 19734d862b1..5286ce11734 100644 --- a/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/AllowNonRestoredStateQueryParameter.java +++ b/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/AllowNonRestoredStateQueryParameter.java @@ -42,4 +42,10 @@ public Boolean convertStringToValue(final String value) { public String convertValueToString(final Boolean value) { return value.toString(); } + + @Override + public String getDescription() { + return "Boolean value that specifies whether the job submission should be rejected " + + "if the savepoint contains state that cannot be mapped back to the job."; + } } diff --git a/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/EntryClassQueryParameter.java b/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/EntryClassQueryParameter.java index 05298a6b01a..e1c7c44e362 100644 --- a/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/EntryClassQueryParameter.java +++ b/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/EntryClassQueryParameter.java @@ -28,4 +28,10 @@ public EntryClassQueryParameter() { super("entry-class", MessageParameterRequisiteness.OPTIONAL); } + + @Override + public String getDescription() { + return "String value that specifies the fully qualified name of the entry point class. " + + "Overrides the class defined in the jar file manifest."; + } } diff --git a/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/JarIdPathParameter.java b/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/JarIdPathParameter.java index 4120ed2999c..29862ae66c8 100644 --- a/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/JarIdPathParameter.java +++ b/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/JarIdPathParameter.java @@ -48,4 +48,11 @@ protected String convertFromString(final String value) throws ConversionExceptio protected String convertToString(final String value) { return value; } + + @Override + public String getDescription() { + return "String value that identifies a jar. When uploading the jar a path is returned, where the filename " + + "is the ID. This value is equivalent to the `" + JarListInfo.JarFileInfo.JAR_FILE_FIELD_ID + "` field " + + "in the list of uploaded jars (" + JarListHeaders.URL + ")."; + } } diff --git a/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/ParallelismQueryParameter.java b/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/ParallelismQueryParameter.java index 398bcb06477..48b79f7f472 100644 --- a/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/ParallelismQueryParameter.java +++ b/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/ParallelismQueryParameter.java @@ -41,4 +41,9 @@ public Integer convertStringToValue(final String value) { public String convertValueToString(final Integer value) { return value.toString(); } + + @Override + public String getDescription() { + return "Positive integer value that specifies the desired parallelism for the job."; + } } diff --git a/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/ProgramArgsQueryParameter.java b/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/ProgramArgsQueryParameter.java index 8f546ab1d4d..d4b0a4fdd23 100644 --- a/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/ProgramArgsQueryParameter.java +++ b/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/ProgramArgsQueryParameter.java @@ -30,4 +30,8 @@ public ProgramArgsQueryParameter() { super("program-args", MessageParameterRequisiteness.OPTIONAL); } + @Override + public String getDescription() { + return "String value that specifies the arguments for the program or plan."; + } } diff --git a/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/SavepointPathQueryParameter.java b/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/SavepointPathQueryParameter.java index c1c6d2b55cd..2159ed90baf 100644 --- a/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/SavepointPathQueryParameter.java +++ b/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/SavepointPathQueryParameter.java @@ -28,4 +28,9 @@ public SavepointPathQueryParameter() { super(KEY, MessageParameterRequisiteness.OPTIONAL); } + + @Override + public String getDescription() { + return "String value that specifies the path of the savepoint to restore the job from."; + } } diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/AccumulatorsIncludeSerializedValueQueryParameter.java b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/AccumulatorsIncludeSerializedValueQueryParameter.java index 1f685c215b5..a67295e4d1c 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/AccumulatorsIncludeSerializedValueQueryParameter.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/AccumulatorsIncludeSerializedValueQueryParameter.java @@ -38,4 +38,9 @@ public String convertValueToString(Boolean value) { public Boolean convertStringToValue(String value) { return Boolean.valueOf(value); } + + @Override + public String getDescription() { + return "Boolean value that specifies whether serialized user task accumulators should be included in the response."; + } } diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/JobIDPathParameter.java b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/JobIDPathParameter.java index fabcd4debd3..e53ab3ee64f 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/JobIDPathParameter.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/JobIDPathParameter.java @@ -40,4 +40,9 @@ protected JobID convertFromString(String value) { protected String convertToString(JobID value) { return value.toString(); } + + @Override + public String getDescription() { + return "32-character hexadecimal string value that identifies a job."; + } } diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/JobVertexIdPathParameter.java b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/JobVertexIdPathParameter.java index 6f9a4eaac96..52c8aa9cd7d 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/JobVertexIdPathParameter.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/JobVertexIdPathParameter.java @@ -40,4 +40,9 @@ protected JobVertexID convertFromString(String value) throws ConversionException protected String convertToString(JobVertexID value) { return value.toString(); } + + @Override + public String getDescription() { + return "32-character hexadecimal string value that identifies a job vertex."; + } } diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/MessageParameter.java b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/MessageParameter.java index b8485e502e1..98ecf343556 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/MessageParameter.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/MessageParameter.java @@ -137,4 +137,10 @@ public final boolean isMandatory() { MANDATORY, OPTIONAL } + + /** + * Returns a description for REST API HTML documentation. + * @return escaped HTML string + */ + public abstract String getDescription(); } diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/RescalingParallelismQueryParameter.java b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/RescalingParallelismQueryParameter.java index 5c4f912a2d7..3deacb2b70d 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/RescalingParallelismQueryParameter.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/RescalingParallelismQueryParameter.java @@ -38,4 +38,9 @@ public Integer convertStringToValue(String value) { public String convertValueToString(Integer value) { return value.toString(); } + + @Override + public String getDescription() { + return "Positive integer value that specifies the desired parallelism."; + } } diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/SubtaskIndexPathParameter.java b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/SubtaskIndexPathParameter.java index e8f22686084..8f4d8f6b510 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/SubtaskIndexPathParameter.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/SubtaskIndexPathParameter.java @@ -44,4 +44,9 @@ protected String convertToString(final Integer value) { return value.toString(); } + @Override + public String getDescription() { + return "Positive integer value that identifies a subtask."; + } + } diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/TerminationModeQueryParameter.java b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/TerminationModeQueryParameter.java index 889b6d5621e..2f89b72b1d5 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/TerminationModeQueryParameter.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/TerminationModeQueryParameter.java @@ -19,6 +19,7 @@ package org.apache.flink.runtime.rest.messages; import org.apache.flink.runtime.rest.handler.legacy.JobCancellationHandler; +import org.apache.flink.util.StringUtils; /** * Termination mode for the {@link JobCancellationHandler}. @@ -41,6 +42,12 @@ public String convertValueToString(TerminationMode value) { return value.name().toLowerCase(); } + @Override + public String getDescription() { + return "String value that specifies the termination mode. Supported values are: " + + StringUtils.toQuotedListString(TerminationMode.values()) + '.'; + } + /** * Supported termination modes. */ diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/TriggerIdPathParameter.java b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/TriggerIdPathParameter.java index 5786b35eae8..542fc40b096 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/TriggerIdPathParameter.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/TriggerIdPathParameter.java @@ -38,4 +38,10 @@ protected TriggerId convertFromString(String value) throws ConversionException { protected String convertToString(TriggerId value) { return value.toString(); } + + @Override + public String getDescription() { + return "32-character hexadecimal string that identifies an asynchronous operation trigger ID. " + + "The ID was returned then the operation was triggered."; + } } diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/checkpoints/CheckpointIdPathParameter.java b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/checkpoints/CheckpointIdPathParameter.java index c08cc82acb1..c2e051c766e 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/checkpoints/CheckpointIdPathParameter.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/checkpoints/CheckpointIdPathParameter.java @@ -45,4 +45,9 @@ protected Long convertFromString(String value) throws ConversionException { protected String convertToString(Long value) { return value.toString(); } + + @Override + public String getDescription() { + return "Long value that identifies a checkpoint."; + } } diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/job/JobSubmitHeaders.java b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/job/JobSubmitHeaders.java index 42f64b064a8..a24b2990bcc 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/job/JobSubmitHeaders.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/job/JobSubmitHeaders.java @@ -72,9 +72,9 @@ public static JobSubmitHeaders getInstance() { @Override public String getDescription() { - return "Submits a job. This call is primarily intended to be used by the Flink client. This call expects a" + - "multipart/form-data request that consists of file uploads for the serialized JobGraph, jars and" + - "distributed cache artifacts and an attribute named \"" + FileUploadHandler.HTTP_ATTRIBUTE_REQUEST + "\"for " + + return "Submits a job. This call is primarily intended to be used by the Flink client. This call expects a " + + "multipart/form-data request that consists of file uploads for the serialized JobGraph, jars and " + + "distributed cache artifacts and an attribute named \"" + FileUploadHandler.HTTP_ATTRIBUTE_REQUEST + "\" for " + "the JSON payload."; } diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/job/SubtaskAttemptPathParameter.java b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/job/SubtaskAttemptPathParameter.java index 220a121eac8..08a53660e49 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/job/SubtaskAttemptPathParameter.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/job/SubtaskAttemptPathParameter.java @@ -50,4 +50,9 @@ protected Integer convertFromString(String value) throws ConversionException { protected String convertToString(Integer value) { return value.toString(); } + + @Override + public String getDescription() { + return "Positive integer value that identifies an execution attempt."; + } } diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/job/metrics/JobsFilterQueryParameter.java b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/job/metrics/JobsFilterQueryParameter.java index fb57f87c928..5fd033fa1e6 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/job/metrics/JobsFilterQueryParameter.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/job/metrics/JobsFilterQueryParameter.java @@ -45,4 +45,9 @@ public JobID convertStringToValue(String value) throws ConversionException { public String convertValueToString(JobID value) { return value.toString(); } + + @Override + public String getDescription() { + return "Comma-separated list of 32-character hexadecimal strings to select specific jobs."; + } } diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/job/metrics/MetricsAggregationParameter.java b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/job/metrics/MetricsAggregationParameter.java index 1057788da91..494e4d8eb7c 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/job/metrics/MetricsAggregationParameter.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/job/metrics/MetricsAggregationParameter.java @@ -20,6 +20,7 @@ import org.apache.flink.runtime.rest.messages.ConversionException; import org.apache.flink.runtime.rest.messages.MessageQueryParameter; +import org.apache.flink.util.StringUtils; import java.util.Locale; @@ -46,6 +47,12 @@ public String convertValueToString(AggregationMode value) { return value.name().toLowerCase(); } + @Override + public String getDescription() { + return "Comma-separated list of aggregation modes which should be calculated. " + + "Available aggregations are: " + StringUtils.toQuotedListString(AggregationMode.values()) + '.'; + } + /** * The available aggregations. */ diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/job/metrics/MetricsFilterParameter.java b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/job/metrics/MetricsFilterParameter.java index 9c6c0fd66b4..b7f6890a22f 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/job/metrics/MetricsFilterParameter.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/job/metrics/MetricsFilterParameter.java @@ -45,4 +45,8 @@ public String convertValueToString(String value) { return value; } + @Override + public String getDescription() { + return "Comma-separated list of string values to select specific metrics."; + } } diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/job/metrics/SubtasksFilterQueryParameter.java b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/job/metrics/SubtasksFilterQueryParameter.java index fe5d37e2048..c3ca85fa1e9 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/job/metrics/SubtasksFilterQueryParameter.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/job/metrics/SubtasksFilterQueryParameter.java @@ -38,4 +38,9 @@ public String convertStringToValue(String value) { public String convertValueToString(String value) { return value; } + + @Override + public String getDescription() { + return "Comma-separated list of integer ranges (e.g. \"1,3,5-9\") to select specific subtasks."; + } } diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/job/metrics/TaskManagersFilterQueryParameter.java b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/job/metrics/TaskManagersFilterQueryParameter.java index dcd6934b9a4..68c53be99a4 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/job/metrics/TaskManagersFilterQueryParameter.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/job/metrics/TaskManagersFilterQueryParameter.java @@ -39,4 +39,9 @@ public ResourceID convertStringToValue(String value) { public String convertValueToString(ResourceID value) { return value.getResourceIdString(); } + + @Override + public String getDescription() { + return "Comma-separated list of 32-character hexadecimal strings to select specific task managers."; + } } diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/taskmanager/TaskManagerIdPathParameter.java b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/taskmanager/TaskManagerIdPathParameter.java index f1daf0f8331..627be851965 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/taskmanager/TaskManagerIdPathParameter.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/taskmanager/TaskManagerIdPathParameter.java @@ -41,4 +41,9 @@ protected ResourceID convertFromString(String value) { protected String convertToString(ResourceID value) { return value.getResourceIdString(); } + + @Override + public String getDescription() { + return "32-character hexadecimal string that identifies a task manager."; + } } diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/rest/RestServerEndpointITCase.java b/flink-runtime/src/test/java/org/apache/flink/runtime/rest/RestServerEndpointITCase.java index 9251ffe7609..31f78e36cf8 100644 --- a/flink-runtime/src/test/java/org/apache/flink/runtime/rest/RestServerEndpointITCase.java +++ b/flink-runtime/src/test/java/org/apache/flink/runtime/rest/RestServerEndpointITCase.java @@ -616,6 +616,11 @@ public JobID convertFromString(String value) { protected String convertToString(JobID value) { return value.toString(); } + + @Override + public String getDescription() { + return "correct JobID parameter"; + } } static class FaultyJobIDPathParameter extends MessagePathParameter<JobID> { @@ -633,6 +638,11 @@ protected JobID convertFromString(String value) throws ConversionException { protected String convertToString(JobID value) { return "foobar"; } + + @Override + public String getDescription() { + return "faulty JobID parameter"; + } } static class JobIDQueryParameter extends MessageQueryParameter<JobID> { @@ -649,6 +659,11 @@ public JobID convertStringToValue(String value) { public String convertValueToString(JobID value) { return value.toString(); } + + @Override + public String getDescription() { + return "query JobID parameter"; + } } private static class TestUploadHandler extends AbstractRestHandler<RestfulGateway, EmptyRequestBody, EmptyResponseBody, EmptyMessageParameters> { diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/rest/handler/util/HandlerRequestUtilsTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/rest/handler/util/HandlerRequestUtilsTest.java index 5001e3daf6a..20748f7aa18 100644 --- a/flink-runtime/src/test/java/org/apache/flink/runtime/rest/handler/util/HandlerRequestUtilsTest.java +++ b/flink-runtime/src/test/java/org/apache/flink/runtime/rest/handler/util/HandlerRequestUtilsTest.java @@ -111,5 +111,10 @@ public Boolean convertStringToValue(final String value) { public String convertValueToString(final Boolean value) { return value.toString(); } + + @Override + public String getDescription() { + return "boolean query parameter"; + } } } diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/rest/messages/MessageParametersTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/rest/messages/MessageParametersTest.java index 104673dfdc6..94fe47cc22d 100644 --- a/flink-runtime/src/test/java/org/apache/flink/runtime/rest/messages/MessageParametersTest.java +++ b/flink-runtime/src/test/java/org/apache/flink/runtime/rest/messages/MessageParametersTest.java @@ -92,6 +92,11 @@ public JobID convertFromString(String value) { protected String convertToString(JobID value) { return value.toString(); } + + @Override + public String getDescription() { + return "path parameter"; + } } private static class TestQueryParameter extends MessageQueryParameter<JobID> { @@ -109,5 +114,10 @@ public JobID convertStringToValue(String value) { public String convertValueToString(JobID value) { return value.toString(); } + + @Override + public String getDescription() { + return "query parameter"; + } } } ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add description to MessageParameter > ----------------------------------- > > Key: FLINK-8135 > URL: https://issues.apache.org/jira/browse/FLINK-8135 > Project: Flink > Issue Type: Improvement > Components: Documentation, REST > Reporter: Chesnay Schepler > Assignee: Andrei > Priority: Major > Labels: pull-request-available > Fix For: 1.7.0 > > > For documentation purposes we should add an {{getDescription()}} method to > the {{MessageParameter}} class, describing what this particular parameter is > used for and which values are accepted. -- This message was sent by Atlassian JIRA (v7.6.3#76005)