Skip to content

Commit

Permalink
[FLINK-14504][rest] Add Cluster DataSet REST API
Browse files Browse the repository at this point in the history
  • Loading branch information
zentol committed Apr 14, 2020
1 parent fbefc4a commit 5da6ce8
Show file tree
Hide file tree
Showing 15 changed files with 1,024 additions and 2 deletions.
181 changes: 181 additions & 0 deletions docs/_includes/generated/rest_v1_dispatcher.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,187 @@
</tr>
</tbody>
</table>
<table class="table table-bordered">
<tbody>
<tr>
<td class="text-left" colspan="2"><h5><strong>/datasets</strong></h5></td>
</tr>
<tr>
<td class="text-left" style="width: 20%">Verb: <code>GET</code></td>
<td class="text-left">Response code: <code>200 OK</code></td>
</tr>
<tr>
<td colspan="2">Returns all cluster data sets.</td>
</tr>
<tr>
<td colspan="2">
<button data-toggle="collapse" data-target="#-2127843514">Request</button>
<div id="-2127843514" class="collapse">
<pre>
<code>
{} </code>
</pre>
</div>
</td>
</tr>
<tr>
<td colspan="2">
<button data-toggle="collapse" data-target="#2178839">Response</button>
<div id="2178839" class="collapse">
<pre>
<code>
{
"type" : "object",
"id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:dataset:ClusterDataSetListResponseBody",
"properties" : {
"dataSets" : {
"type" : "array",
"items" : {
"type" : "object",
"id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:dataset:ClusterDataSetEntry",
"properties" : {
"id" : {
"type" : "string"
},
"isComplete" : {
"type" : "boolean"
}
}
}
}
}
} </code>
</pre>
</div>
</td>
</tr>
</tbody>
</table>
<table class="table table-bordered">
<tbody>
<tr>
<td class="text-left" colspan="2"><h5><strong>/datasets/delete/:triggerid</strong></h5></td>
</tr>
<tr>
<td class="text-left" style="width: 20%">Verb: <code>GET</code></td>
<td class="text-left">Response code: <code>200 OK</code></td>
</tr>
<tr>
<td colspan="2">Returns the status for the delete operation of a cluster data set.</td>
</tr>
<tr>
<td colspan="2">Path parameters</td>
</tr>
<tr>
<td colspan="2">
<ul>
<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>
<tr>
<td colspan="2">
<button data-toggle="collapse" data-target="#-2131471052">Request</button>
<div id="-2131471052" class="collapse">
<pre>
<code>
{} </code>
</pre>
</div>
</td>
</tr>
<tr>
<td colspan="2">
<button data-toggle="collapse" data-target="#330413108">Response</button>
<div id="330413108" class="collapse">
<pre>
<code>
{
"type" : "object",
"id" : "urn:jsonschema:org:apache:flink:runtime:rest:handler:async:AsynchronousOperationResult",
"properties" : {
"operation" : {
"type" : "object",
"id" : "urn:jsonschema:org:apache:flink:runtime:rest:handler:async:AsynchronousOperationInfo",
"properties" : {
"failure-cause" : {
"type" : "any"
}
}
},
"status" : {
"type" : "object",
"id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:queue:QueueStatus",
"properties" : {
"id" : {
"type" : "string",
"required" : true,
"enum" : [ "IN_PROGRESS", "COMPLETED" ]
}
}
}
}
} </code>
</pre>
</div>
</td>
</tr>
</tbody>
</table>
<table class="table table-bordered">
<tbody>
<tr>
<td class="text-left" colspan="2"><h5><strong>/datasets/:datasetid</strong></h5></td>
</tr>
<tr>
<td class="text-left" style="width: 20%">Verb: <code>DELETE</code></td>
<td class="text-left">Response code: <code>202 Accepted</code></td>
</tr>
<tr>
<td colspan="2">Triggers the deletion of a cluster data set. This async operation would return a 'triggerid' for further query identifier.</td>
</tr>
<tr>
<td colspan="2">Path parameters</td>
</tr>
<tr>
<td colspan="2">
<ul>
<li><code>datasetid</code> - 32-character hexadecimal string value that identifies a cluster data set.</li>
</ul>
</td>
</tr>
<tr>
<td colspan="2">
<button data-toggle="collapse" data-target="#1341404463">Request</button>
<div id="1341404463" class="collapse">
<pre>
<code>
{} </code>
</pre>
</div>
</td>
</tr>
<tr>
<td colspan="2">
<button data-toggle="collapse" data-target="#711384652">Response</button>
<div id="711384652" class="collapse">
<pre>
<code>
{
"type" : "object",
"id" : "urn:jsonschema:org:apache:flink:runtime:rest:handler:async:TriggerResponse",
"properties" : {
"request-id" : {
"type" : "any"
}
}
} </code>
</pre>
</div>
</td>
</tr>
</tbody>
</table>
<table class="table table-bordered">
<tbody>
<tr>
Expand Down
96 changes: 96 additions & 0 deletions flink-runtime-web/src/test/resources/rest_api_v1.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,102 @@
}
}
}
}, {
"url" : "/datasets",
"method" : "GET",
"status-code" : "200 OK",
"file-upload" : false,
"path-parameters" : {
"pathParameters" : [ ]
},
"query-parameters" : {
"queryParameters" : [ ]
},
"request" : {
"type" : "any"
},
"response" : {
"type" : "object",
"id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:dataset:ClusterDataSetListResponseBody",
"properties" : {
"dataSets" : {
"type" : "array",
"items" : {
"type" : "object",
"id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:dataset:ClusterDataSetEntry",
"properties" : {
"id" : {
"type" : "string"
},
"isComplete" : {
"type" : "boolean"
}
}
}
}
}
}
}, {
"url" : "/datasets/delete/:triggerid",
"method" : "GET",
"status-code" : "200 OK",
"file-upload" : false,
"path-parameters" : {
"pathParameters" : [ {
"key" : "triggerid"
} ]
},
"query-parameters" : {
"queryParameters" : [ ]
},
"request" : {
"type" : "any"
},
"response" : {
"type" : "object",
"id" : "urn:jsonschema:org:apache:flink:runtime:rest:handler:async:AsynchronousOperationResult",
"properties" : {
"status" : {
"type" : "object",
"id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:queue:QueueStatus",
"properties" : {
"id" : {
"type" : "string",
"required" : true,
"enum" : [ "IN_PROGRESS", "COMPLETED" ]
}
}
},
"operation" : {
"type" : "any"
}
}
}
}, {
"url" : "/datasets/:datasetid",
"method" : "DELETE",
"status-code" : "202 Accepted",
"file-upload" : false,
"path-parameters" : {
"pathParameters" : [ {
"key" : "datasetid"
} ]
},
"query-parameters" : {
"queryParameters" : [ ]
},
"request" : {
"type" : "any"
},
"response" : {
"type" : "object",
"id" : "urn:jsonschema:org:apache:flink:runtime:rest:handler:async:TriggerResponse",
"properties" : {
"request-id" : {
"type" : "any"
}
}
}
}, {
"url" : "/jars",
"method" : "GET",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.apache.flink.runtime.io.network.partition;

import org.apache.flink.annotation.VisibleForTesting;
import org.apache.flink.util.Preconditions;

import java.util.Optional;
Expand All @@ -30,7 +31,7 @@ public final class DataSetMetaInfo {
private final int numRegisteredPartitions;
private final int numTotalPartitions;

public DataSetMetaInfo(int numRegisteredPartitions, int numTotalPartitions) {
private DataSetMetaInfo(int numRegisteredPartitions, int numTotalPartitions) {
this.numRegisteredPartitions = numRegisteredPartitions;
this.numTotalPartitions = numTotalPartitions;
}
Expand All @@ -49,7 +50,8 @@ static DataSetMetaInfo withoutNumRegisteredPartitions(int numTotalPartitions) {
return new DataSetMetaInfo(UNKNOWN, numTotalPartitions);
}

static DataSetMetaInfo withNumRegisteredPartitions(int numRegisteredPartitions, int numTotalPartitions) {
@VisibleForTesting
public static DataSetMetaInfo withNumRegisteredPartitions(int numRegisteredPartitions, int numTotalPartitions) {
Preconditions.checkArgument(numRegisteredPartitions > 0);
return new DataSetMetaInfo(numRegisteredPartitions, numTotalPartitions);
}
Expand Down
Loading

0 comments on commit 5da6ce8

Please sign in to comment.