Class MiniClusterClient

    • Constructor Detail

      • MiniClusterClient

        public MiniClusterClient​(@Nonnull
                                 org.apache.flink.configuration.Configuration configuration,
                                 @Nonnull
                                 org.apache.flink.runtime.minicluster.MiniCluster miniCluster)
    • Method Detail

      • cancelWithSavepoint

        public CompletableFuture<String> cancelWithSavepoint​(org.apache.flink.api.common.JobID jobId,
                                                             @Nullable
                                                             String savepointDirectory,
                                                             org.apache.flink.core.execution.SavepointFormatType formatType)
        Description copied from interface: ClusterClient
        Cancels a job identified by the job id and triggers a savepoint.
        Specified by:
        cancelWithSavepoint in interface ClusterClient<MiniClusterClient.MiniClusterId>
        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

        public CompletableFuture<String> stopWithSavepoint​(org.apache.flink.api.common.JobID jobId,
                                                           boolean advanceToEndOfEventTime,
                                                           @Nullable
                                                           String savepointDirectory,
                                                           org.apache.flink.core.execution.SavepointFormatType formatType)
        Description copied from interface: ClusterClient
        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.
        Specified by:
        stopWithSavepoint in interface ClusterClient<MiniClusterClient.MiniClusterId>
        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

        public CompletableFuture<String> stopWithDetachedSavepoint​(org.apache.flink.api.common.JobID jobId,
                                                                   boolean advanceToEndOfEventTime,
                                                                   @Nullable
                                                                   String savepointDirectory,
                                                                   org.apache.flink.core.execution.SavepointFormatType formatType)
        Description copied from interface: ClusterClient
        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.
        Specified by:
        stopWithDetachedSavepoint in interface ClusterClient<MiniClusterClient.MiniClusterId>
        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

        public CompletableFuture<String> triggerSavepoint​(org.apache.flink.api.common.JobID jobId,
                                                          @Nullable
                                                          String savepointDirectory,
                                                          org.apache.flink.core.execution.SavepointFormatType formatType)
        Description copied from interface: ClusterClient
        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.
        Specified by:
        triggerSavepoint in interface ClusterClient<MiniClusterClient.MiniClusterId>
        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

        public CompletableFuture<Long> triggerCheckpoint​(org.apache.flink.api.common.JobID jobId,
                                                         org.apache.flink.core.execution.CheckpointType checkpointType)
        Description copied from interface: ClusterClient
        Triggers a checkpoint for the job identified by the job id. The checkpoint will be written to the checkpoint directory for the job.
        Specified by:
        triggerCheckpoint in interface ClusterClient<MiniClusterClient.MiniClusterId>
        Parameters:
        jobId - job id
        checkpointType - the checkpoint type (configured / full / incremental)
      • triggerDetachedSavepoint

        public CompletableFuture<String> triggerDetachedSavepoint​(org.apache.flink.api.common.JobID jobId,
                                                                  @Nullable
                                                                  String savepointDirectory,
                                                                  org.apache.flink.core.execution.SavepointFormatType formatType)
        Description copied from interface: ClusterClient
        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.
        Specified by:
        triggerDetachedSavepoint in interface ClusterClient<MiniClusterClient.MiniClusterId>
        Parameters:
        jobId - job id
        savepointDirectory - directory the savepoint should be written to
        formatType - a binary format of the savepoint
        Returns:
        the savepoint trigger id
      • getAccumulators

        public CompletableFuture<Map<String,​Object>> getAccumulators​(org.apache.flink.api.common.JobID jobID,
                                                                           ClassLoader loader)
        Description copied from interface: ClusterClient
        Requests and returns the accumulators for the given job identifier. Accumulators can be requested while a is running or after it has finished.
        Specified by:
        getAccumulators in interface ClusterClient<MiniClusterClient.MiniClusterId>
        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.
      • sendCoordinationRequest

        public CompletableFuture<org.apache.flink.runtime.operators.coordination.CoordinationResponse> sendCoordinationRequest​(org.apache.flink.api.common.JobID jobId,
                                                                                                                               org.apache.flink.runtime.jobgraph.OperatorID operatorId,
                                                                                                                               org.apache.flink.runtime.operators.coordination.CoordinationRequest request)
        Description copied from interface: ClusterClient
        Sends out a request to a specified coordinator and return the response.
        Specified by:
        sendCoordinationRequest in interface ClusterClient<MiniClusterClient.MiniClusterId>
        Parameters:
        jobId - specifies the job which the coordinator belongs to
        operatorId - specifies which coordinator to receive the request
        request - the request to send
        Returns:
        the response from the coordinator