Interface ClusterClient<T>

    • Method Detail

      • getClusterId

        T getClusterId()
        Returns the cluster id identifying the cluster to which the client is connected.
        Returns:
        cluster id of the connected cluster
      • getFlinkConfiguration

        Configuration getFlinkConfiguration()
        Return the Flink configuration object.
        Returns:
        The Flink configuration object
      • shutDownCluster

        void shutDownCluster()
        Shut down the cluster that this client communicate with.
      • getWebInterfaceURL

        String getWebInterfaceURL()
        Returns an URL (as a string) to the cluster web interface.
      • getAccumulators

        default CompletableFuture<Map<String,​Object>> getAccumulators​(JobID jobID)
        Requests and returns the accumulators for the given job identifier. Accumulators can be requested while a is running or after it has finished. The default class loader is used to deserialize the incoming accumulator results.
        Parameters:
        jobID - The job identifier of a job.
        Returns:
        A Map containing the accumulator's name and its value.
      • getAccumulators

        CompletableFuture<Map<String,​Object>> getAccumulators​(JobID jobID,
                                                                    ClassLoader loader)
        Requests and returns the accumulators for the given job identifier. Accumulators can be requested while a is running or after it has finished.
        Parameters:
        jobID - The job identifier of a job.
        loader - The class loader for deserializing the accumulator results.
        Returns:
        A Map containing the accumulator's name and its value.
      • cancelWithSavepoint

        CompletableFuture<String> cancelWithSavepoint​(JobID jobId,
                                                      @Nullable
                                                      String savepointDirectory,
                                                      SavepointFormatType formatType)
        Cancels a job identified by the job id and triggers a savepoint.
        Parameters:
        jobId - the job id
        savepointDirectory - directory the savepoint should be written to
        formatType - a binary format of the savepoint
        Returns:
        future of path where the savepoint is located
      • stopWithSavepoint

        CompletableFuture<String> stopWithSavepoint​(JobID jobId,
                                                    boolean advanceToEndOfEventTime,
                                                    @Nullable
                                                    String savepointDirectory,
                                                    SavepointFormatType formatType)
        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.
        Parameters:
        jobId - the job ID of the streaming program to stop
        advanceToEndOfEventTime - flag indicating if the source should inject a MAX_WATERMARK in the pipeline
        savepointDirectory - directory the savepoint should be written to
        formatType - a binary format of the savepoint
        Returns:
        a CompletableFuture containing the path where the savepoint is located
      • stopWithDetachedSavepoint

        CompletableFuture<String> stopWithDetachedSavepoint​(JobID jobId,
                                                            boolean advanceToEndOfEventTime,
                                                            @Nullable
                                                            String savepointDirectory,
                                                            SavepointFormatType formatType)
        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.
        Parameters:
        jobId - the job ID of the streaming program to stop
        advanceToEndOfEventTime - flag indicating if the source should inject a MAX_WATERMARK in the pipeline
        savepointDirectory - directory the savepoint should be written to
        formatType - a binary format of the savepoint
        Returns:
        the savepoint trigger id
      • triggerSavepoint

        CompletableFuture<String> triggerSavepoint​(JobID jobId,
                                                   @Nullable
                                                   String savepointDirectory,
                                                   SavepointFormatType formatType)
        Triggers a savepoint for the job identified by the job id. The savepoint will be written to the given savepoint directory, or CheckpointingOptions.SAVEPOINT_DIRECTORY if it is null.
        Parameters:
        jobId - job id
        savepointDirectory - directory the savepoint should be written to
        formatType - a binary format of the savepoint
        Returns:
        path future where the savepoint is located
      • triggerCheckpoint

        CompletableFuture<Long> triggerCheckpoint​(JobID jobId,
                                                  CheckpointType checkpointType)
        Triggers a checkpoint for the job identified by the job id. The checkpoint will be written to the checkpoint directory for the job.
        Parameters:
        jobId - job id
        checkpointType - the checkpoint type (configured / full / incremental)
      • triggerDetachedSavepoint

        CompletableFuture<String> triggerDetachedSavepoint​(JobID jobId,
                                                           @Nullable
                                                           String savepointDirectory,
                                                           SavepointFormatType formatType)
        Triggers a detached savepoint for the job identified by the job id. The savepoint will be written to the given savepoint directory, or CheckpointingOptions.SAVEPOINT_DIRECTORY if it is null. Notice that: the detached savepoint will return with a savepoint trigger id instead of the path future, that means the client will return very quickly.
        Parameters:
        jobId - job id
        savepointDirectory - directory the savepoint should be written to
        formatType - a binary format of the savepoint
        Returns:
        the savepoint trigger id
      • sendCoordinationRequest

        CompletableFuture<CoordinationResponse> sendCoordinationRequest​(JobID jobId,
                                                                        String operatorUid,
                                                                        CoordinationRequest request)
        Sends out a request to a specified coordinator and return the response.

        On the client side, a unique operatorUid must be defined to identify an operator. Otherwise, the query cannot be executed correctly. Note that we use operatorUid instead of operatorID because the latter is an internal runtime concept that cannot be recognized by the client.

        Parameters:
        jobId - specifies the job which the coordinator belongs to
        operatorUid - specifies which coordinator to receive the request
        request - the request to send
        Returns:
        the response from the coordinator
      • listCompletedClusterDatasetIds

        default CompletableFuture<Set<AbstractID>> listCompletedClusterDatasetIds()
        Return a set of ids of the completed cluster datasets.
        Returns:
        A set of ids of the completely cached intermediate dataset.
      • invalidateClusterDataset

        default CompletableFuture<Void> invalidateClusterDataset​(AbstractID clusterDatasetId)
        Invalidate the cached intermediate dataset with the given id.
        Parameters:
        clusterDatasetId - id of the cluster dataset to be invalidated.
        Returns:
        Future which will be completed when the cached dataset is invalidated.
      • reportHeartbeat

        default CompletableFuture<Void> reportHeartbeat​(JobID jobId,
                                                        long expiredTimestamp)
        The client reports the heartbeat to the dispatcher for aliveness.
        Parameters:
        jobId - The jobId for the client and the job.
        Returns: