Search in sources :

Example 1 with KvStateClientProxy

use of org.apache.flink.runtime.query.KvStateClientProxy in project flink by apache.

the class TaskExecutor method disassociateFromJobManager.

private void disassociateFromJobManager(JobTable.Connection jobManagerConnection, Exception cause) throws IOException {
    checkNotNull(jobManagerConnection);
    final JobID jobId = jobManagerConnection.getJobId();
    // cleanup remaining partitions once all tasks for this job have completed
    scheduleResultPartitionCleanup(jobId);
    final KvStateRegistry kvStateRegistry = kvStateService.getKvStateRegistry();
    if (kvStateRegistry != null) {
        kvStateRegistry.unregisterListener(jobId);
    }
    final KvStateClientProxy kvStateClientProxy = kvStateService.getKvStateClientProxy();
    if (kvStateClientProxy != null) {
        kvStateClientProxy.updateKvStateLocationOracle(jobManagerConnection.getJobId(), null);
    }
    JobMasterGateway jobManagerGateway = jobManagerConnection.getJobManagerGateway();
    jobManagerGateway.disconnectTaskManager(getResourceID(), cause);
}
Also used : KvStateRegistry(org.apache.flink.runtime.query.KvStateRegistry) KvStateClientProxy(org.apache.flink.runtime.query.KvStateClientProxy) JobMasterGateway(org.apache.flink.runtime.jobmaster.JobMasterGateway) JobID(org.apache.flink.api.common.JobID)

Example 2 with KvStateClientProxy

use of org.apache.flink.runtime.query.KvStateClientProxy in project flink by apache.

the class TaskExecutor method registerQueryableState.

private void registerQueryableState(JobID jobId, JobMasterGateway jobMasterGateway) {
    final KvStateServer kvStateServer = kvStateService.getKvStateServer();
    final KvStateRegistry kvStateRegistry = kvStateService.getKvStateRegistry();
    if (kvStateServer != null && kvStateRegistry != null) {
        kvStateRegistry.registerListener(jobId, new RpcKvStateRegistryListener(jobMasterGateway, kvStateServer.getServerAddress()));
    }
    final KvStateClientProxy kvStateProxy = kvStateService.getKvStateClientProxy();
    if (kvStateProxy != null) {
        kvStateProxy.updateKvStateLocationOracle(jobId, jobMasterGateway);
    }
}
Also used : KvStateRegistry(org.apache.flink.runtime.query.KvStateRegistry) RpcKvStateRegistryListener(org.apache.flink.runtime.taskexecutor.rpc.RpcKvStateRegistryListener) KvStateClientProxy(org.apache.flink.runtime.query.KvStateClientProxy) KvStateServer(org.apache.flink.runtime.query.KvStateServer)

Example 3 with KvStateClientProxy

use of org.apache.flink.runtime.query.KvStateClientProxy in project flink by apache.

the class KvStateService method fromConfiguration.

// --------------------------------------------------------------------------------------------
// Static factory methods for kvState service
// --------------------------------------------------------------------------------------------
/**
 * Creates and returns the KvState service.
 *
 * @param taskManagerServicesConfiguration task manager configuration
 * @return service for kvState related components
 */
public static KvStateService fromConfiguration(TaskManagerServicesConfiguration taskManagerServicesConfiguration) {
    KvStateRegistry kvStateRegistry = new KvStateRegistry();
    QueryableStateConfiguration qsConfig = taskManagerServicesConfiguration.getQueryableStateConfig();
    KvStateClientProxy kvClientProxy = null;
    KvStateServer kvStateServer = null;
    if (qsConfig != null) {
        int numProxyServerNetworkThreads = qsConfig.numProxyServerThreads() == 0 ? taskManagerServicesConfiguration.getNumberOfSlots() : qsConfig.numProxyServerThreads();
        int numProxyServerQueryThreads = qsConfig.numProxyQueryThreads() == 0 ? taskManagerServicesConfiguration.getNumberOfSlots() : qsConfig.numProxyQueryThreads();
        kvClientProxy = QueryableStateUtils.createKvStateClientProxy(taskManagerServicesConfiguration.getExternalAddress(), qsConfig.getProxyPortRange(), numProxyServerNetworkThreads, numProxyServerQueryThreads, new DisabledKvStateRequestStats());
        int numStateServerNetworkThreads = qsConfig.numStateServerThreads() == 0 ? taskManagerServicesConfiguration.getNumberOfSlots() : qsConfig.numStateServerThreads();
        int numStateServerQueryThreads = qsConfig.numStateQueryThreads() == 0 ? taskManagerServicesConfiguration.getNumberOfSlots() : qsConfig.numStateQueryThreads();
        kvStateServer = QueryableStateUtils.createKvStateServer(taskManagerServicesConfiguration.getExternalAddress(), qsConfig.getStateServerPortRange(), numStateServerNetworkThreads, numStateServerQueryThreads, kvStateRegistry, new DisabledKvStateRequestStats());
    }
    return new KvStateService(kvStateRegistry, kvStateServer, kvClientProxy);
}
Also used : TaskKvStateRegistry(org.apache.flink.runtime.query.TaskKvStateRegistry) KvStateRegistry(org.apache.flink.runtime.query.KvStateRegistry) KvStateClientProxy(org.apache.flink.runtime.query.KvStateClientProxy) KvStateServer(org.apache.flink.runtime.query.KvStateServer) DisabledKvStateRequestStats(org.apache.flink.queryablestate.network.stats.DisabledKvStateRequestStats)

Aggregations

KvStateClientProxy (org.apache.flink.runtime.query.KvStateClientProxy)3 KvStateRegistry (org.apache.flink.runtime.query.KvStateRegistry)3 KvStateServer (org.apache.flink.runtime.query.KvStateServer)2 JobID (org.apache.flink.api.common.JobID)1 DisabledKvStateRequestStats (org.apache.flink.queryablestate.network.stats.DisabledKvStateRequestStats)1 JobMasterGateway (org.apache.flink.runtime.jobmaster.JobMasterGateway)1 TaskKvStateRegistry (org.apache.flink.runtime.query.TaskKvStateRegistry)1 RpcKvStateRegistryListener (org.apache.flink.runtime.taskexecutor.rpc.RpcKvStateRegistryListener)1