kl0u commented on a change in pull request #10069: [FLINK-14593][client] Port 
ClusterClient to asynchronous interface version
URL: https://github.com/apache/flink/pull/10069#discussion_r343015252
 
 

 ##########
 File path: 
flink-clients/src/main/java/org/apache/flink/client/program/ClusterClient.java
 ##########
 @@ -41,78 +41,76 @@
  *
  * @param <T> type of the cluster id
  */
-public abstract class ClusterClient<T> implements AutoCloseable {
-
-       /**
-        * User overridable hook to close the client, possibly closes internal 
services.
-        * @deprecated use the {@link #close()} instead. This method stays for 
backwards compatibility.
-        */
-       public void shutdown() throws Exception {
-               close();
-       }
+public interface ClusterClient<T> extends AutoCloseable {
 
        @Override
-       public void close() throws Exception {
+       default void close() throws Exception {
 
        }
 
        /**
-        * Requests the {@link JobStatus} of the job with the given {@link 
JobID}.
+        * Returns the cluster id identifying the cluster to which the client 
is connected.
+        *
+        * @return cluster id of the connected cluster
         */
-       public abstract CompletableFuture<JobStatus> getJobStatus(JobID jobId);
+       T getClusterId();
 
        /**
-        * Cancels a job identified by the job id.
-        * @param jobId the job id
-        * @throws Exception In case an error occurred.
+        * Return the Flink configuration object.
+        *
+        * @return The Flink configuration object
         */
-       public abstract void cancel(JobID jobId) throws Exception;
+       Configuration getFlinkConfiguration();
 
+       //region cluster management
        /**
-        * Cancels a job identified by the job id and triggers a savepoint.
-        * @param jobId the job id
-        * @param savepointDirectory directory the savepoint should be written 
to
-        * @return path where the savepoint is located
-        * @throws Exception In case an error occurred.
+        * Shut down the cluster that this client communicate with.
         */
-       public abstract String cancelWithSavepoint(JobID jobId, @Nullable 
String savepointDirectory) throws Exception;
+       void shutDownCluster();
 
        /**
-        * Stops a program on Flink cluster whose job-manager is configured in 
this client's configuration.
-        * Stopping works only for streaming programs. Be aware, that the 
program might continue to run for
-        * a while after sending the stop command, because after sources 
stopped to emit data all operators
-        * need to finish processing.
+        * Returns an URL (as a string) to the cluster web interface.
+        */
+       String getWebInterfaceURL();
+
+       /**
+        * Lists the currently running and finished jobs on the cluster.
         *
-        * @param jobId the job ID of the streaming program to stop
-        * @param advanceToEndOfEventTime flag indicating if the source should 
inject a {@code MAX_WATERMARK} in the pipeline
-        * @param savepointDirectory directory the savepoint should be written 
to
-        * @return a {@link CompletableFuture} containing the path where the 
savepoint is located
-        * @throws Exception
-        *             If the job ID is invalid (ie, is unknown or refers to a 
batch job) or if sending the stop signal
-        *             failed. That might be due to an I/O problem, ie, the 
job-manager is unreachable.
+        * @return future collection of running and finished jobs
+        * @throws Exception if no connection to the cluster could be 
established
         */
-       public abstract String stopWithSavepoint(final JobID jobId, final 
boolean advanceToEndOfEventTime, @Nullable final String savepointDirectory) 
throws Exception;
+       CompletableFuture<Collection<JobStatusMessage>> listJobs() throws 
Exception;
 
        /**
-        * Triggers a savepoint for the job identified by the job id. The 
savepoint will be written to the given savepoint
-        * directory, or {@link 
org.apache.flink.configuration.CheckpointingOptions#SAVEPOINT_DIRECTORY} if it 
is null.
+        * Dispose the savepoint under the given path.
         *
-        * @param jobId job id
-        * @param savepointDirectory directory the savepoint should be written 
to
-        * @return path future where the savepoint is located
-        * @throws FlinkException if no connection to the cluster could be 
established
+        * @param savepointPath path to the savepoint to be disposed
+        * @return acknowledge future of the dispose action
         */
-       public abstract CompletableFuture<String> triggerSavepoint(JobID jobId, 
@Nullable String savepointDirectory) throws FlinkException;
+       CompletableFuture<Acknowledge> disposeSavepoint(String savepointPath) 
throws FlinkException;
+       //endregion
 
 Review comment:
   Please remove this comment.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to