Search in sources :

Example 1 with AgentSetPrestoConfResponse

use of alluxio.hub.proto.AgentSetPrestoConfResponse in project alluxio by Alluxio.

the class ManagerProcessContext method setPrestoConfDir.

/**
 * Set Presto configuration directory.
 * @param request presto conf directory request
 * @return response object
 */
public SetPrestoConfDirResponse.Payload setPrestoConfDir(SetPrestoConfDirRequest request) {
    String confDir = request.getPayload().getConfDir();
    SetPrestoConfDirResponse.Payload.Builder builder = SetPrestoConfDirResponse.Payload.newBuilder();
    List<AlluxioNodeType> nodeTypes = ImmutableList.of(AlluxioNodeType.MASTER, AlluxioNodeType.WORKER);
    Map<String, String> map = ImmutableMap.of(PropertyKey.HUB_MANAGER_PRESTO_CONF_PATH.getName(), confDir);
    if (nodeTypes.stream().map(type -> execOnHub((client) -> client.setPrestoConfDir(AgentSetPrestoConfRequest.newBuilder().putAllProps(map).build()), type)).allMatch(response -> response.values().stream().allMatch(AgentSetPrestoConfResponse::getSuccess))) {
        return builder.setSuccess(true).setConfDir(confDir).setIsDefault(confDir.equals(PropertyKey.HUB_MANAGER_PRESTO_CONF_PATH.getDefaultStringValue())).build();
    } else {
        String oldConfDir = getUpdatedProps(configurationSetFor(AlluxioNodeType.MASTER)).getString(PropertyKey.HUB_MANAGER_PRESTO_CONF_PATH);
        return builder.setSuccess(false).setConfDir(oldConfDir).setIsDefault(oldConfDir.equals(PropertyKey.HUB_MANAGER_PRESTO_CONF_PATH.getDefaultStringValue())).build();
    }
}
Also used : RemoveFile(alluxio.hub.proto.RemoveFile) PropertyKey(alluxio.conf.PropertyKey) UploadFile(alluxio.hub.proto.UploadFile) IOTaskSummary(alluxio.stress.worker.IOTaskSummary) FileSystem(alluxio.client.file.FileSystem) SpeedTestRequest(alluxio.hub.proto.SpeedTestRequest) AgentFileUploadResponse(alluxio.hub.proto.AgentFileUploadResponse) Duration(java.time.Duration) Map(java.util.Map) Status(io.grpc.Status) CLUSTER_DEFAULT(alluxio.conf.Source.CLUSTER_DEFAULT) AgentWriteConfigurationSetRequest(alluxio.hub.proto.AgentWriteConfigurationSetRequest) ValidationUtils(alluxio.cli.ValidationUtils) AgentProcessStatusChangeResponse(alluxio.hub.proto.AgentProcessStatusChangeResponse) RpcClient(alluxio.hub.common.RpcClient) Set(java.util.Set) AlluxioException(alluxio.exception.AlluxioException) AgentHeartbeatRequest(alluxio.hub.proto.AgentHeartbeatRequest) ThreadSafe(javax.annotation.concurrent.ThreadSafe) GetPrestoConfDirResponse(alluxio.hub.proto.GetPrestoConfDirResponse) AlluxioProperties(alluxio.conf.AlluxioProperties) StandardCharsets(java.nio.charset.StandardCharsets) Executors(java.util.concurrent.Executors) AgentGetConfigurationSetRequest(alluxio.hub.proto.AgentGetConfigurationSetRequest) Config(io.fabric8.kubernetes.client.Config) Source(alluxio.conf.Source) InstancedConfiguration(alluxio.conf.InstancedConfiguration) AgentFileUploadRequest(alluxio.hub.proto.AgentFileUploadRequest) RuntimeConstants(alluxio.RuntimeConstants) AgentShutdownRequest(alluxio.hub.proto.AgentShutdownRequest) DetectPrestoResponse(alluxio.hub.proto.DetectPrestoResponse) RemoveFileRequest(alluxio.hub.proto.RemoveFileRequest) ProcessStatusChangeResponse(alluxio.hub.proto.ProcessStatusChangeResponse) ArrayList(java.util.ArrayList) UfsIOBench(alluxio.stress.cli.UfsIOBench) AlluxioClusterHeartbeatResponse(alluxio.hub.proto.AlluxioClusterHeartbeatResponse) AlluxioURI(alluxio.AlluxioURI) HubNodeAddress(alluxio.hub.proto.HubNodeAddress) ListMountPointResponse(alluxio.hub.proto.ListMountPointResponse) RequestStreamObserver(alluxio.hub.manager.rpc.observer.RequestStreamObserver) UfsIOParameters(alluxio.stress.worker.UfsIOParameters) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) AlluxioConfiguration(alluxio.conf.AlluxioConfiguration) MountPOptions(alluxio.grpc.MountPOptions) HubAuthenticationInterceptor(alluxio.hub.manager.rpc.interceptor.HubAuthenticationInterceptor) RetryPolicy(alluxio.retry.RetryPolicy) Nullable(javax.annotation.Nullable) ListFile(alluxio.hub.proto.ListFile) Properties(java.util.Properties) AgentDetectPrestoResponse(alluxio.hub.proto.AgentDetectPrestoResponse) PingManagerRequest(alluxio.hub.proto.PingManagerRequest) IOException(java.io.IOException) AgentWriteConfigurationSetResponse(alluxio.hub.proto.AgentWriteConfigurationSetResponse) DeleteMountPointResponse(alluxio.hub.proto.DeleteMountPointResponse) AlluxioClusterHeartbeatRequest(alluxio.hub.proto.AlluxioClusterHeartbeatRequest) ConfigMap(io.fabric8.kubernetes.api.model.ConfigMap) ConfigMapBuilder(io.fabric8.kubernetes.api.model.ConfigMapBuilder) ApplyMountPointResponse(alluxio.hub.proto.ApplyMountPointResponse) Lock(java.util.concurrent.locks.Lock) HubAuthentication(alluxio.hub.proto.HubAuthentication) AgentSetPrestoConfRequest(alluxio.hub.proto.AgentSetPrestoConfRequest) PingManagerResponse(alluxio.hub.proto.PingManagerResponse) Preconditions(com.google.common.base.Preconditions) UploadFileResponse(alluxio.hub.proto.UploadFileResponse) AgentListFileRequest(alluxio.hub.proto.AgentListFileRequest) HubUtil(alluxio.hub.common.HubUtil) DetectPrestoRequest(alluxio.hub.proto.DetectPrestoRequest) AgentSetPrestoConfResponse(alluxio.hub.proto.AgentSetPrestoConfResponse) AlluxioCluster(alluxio.hub.manager.util.AlluxioCluster) AgentShutdownResponse(alluxio.hub.proto.AgentShutdownResponse) ListCatalogRequest(alluxio.hub.proto.ListCatalogRequest) JsonSerializable(alluxio.util.JsonSerializable) AlluxioConfigurationSet(alluxio.hub.proto.AlluxioConfigurationSet) LoggerFactory(org.slf4j.LoggerFactory) SpeedTestResponse(alluxio.hub.proto.SpeedTestResponse) Channel(io.grpc.Channel) GetConfigurationSetResponse(alluxio.hub.proto.GetConfigurationSetResponse) RegisterManagerResponse(alluxio.hub.proto.RegisterManagerResponse) LogUtils(alluxio.util.LogUtils) AgentRemoveFileResponse(alluxio.hub.proto.AgentRemoveFileResponse) HostedManagerServiceGrpc(alluxio.hub.proto.HostedManagerServiceGrpc) InvalidPathException(alluxio.exception.InvalidPathException) StreamObserver(io.grpc.stub.StreamObserver) DeleteMountPointRequest(alluxio.hub.proto.DeleteMountPointRequest) ByteArrayInputStream(java.io.ByteArrayInputStream) GrpcChannel(alluxio.grpc.GrpcChannel) AgentDetectPrestoRequest(alluxio.hub.proto.AgentDetectPrestoRequest) DefaultKubernetesClient(io.fabric8.kubernetes.client.DefaultKubernetesClient) RegisterManagerRequest(alluxio.hub.proto.RegisterManagerRequest) HubCluster(alluxio.hub.manager.util.HubCluster) ServerConfiguration(alluxio.conf.ServerConfiguration) ImmutableMap(com.google.common.collect.ImmutableMap) ExponentialTimeBoundedRetry(alluxio.retry.ExponentialTimeBoundedRetry) ScheduledThreadPoolExecutor(java.util.concurrent.ScheduledThreadPoolExecutor) InetSocketAddress(java.net.InetSocketAddress) Collectors(java.util.stream.Collectors) GetConfigurationSetRequest(alluxio.hub.proto.GetConfigurationSetRequest) SetPrestoConfDirRequest(alluxio.hub.proto.SetPrestoConfDirRequest) ByteString(com.google.protobuf.ByteString) Base64(java.util.Base64) List(java.util.List) SetPrestoConfDirResponse(alluxio.hub.proto.SetPrestoConfDirResponse) HubMetadata(alluxio.hub.proto.HubMetadata) FileDoesNotExistException(alluxio.exception.FileDoesNotExistException) ListCatalogResponse(alluxio.hub.proto.ListCatalogResponse) RemoveFileResponse(alluxio.hub.proto.RemoveFileResponse) Pattern(java.util.regex.Pattern) AgentListCatalogRequest(alluxio.hub.proto.AgentListCatalogRequest) ExponentialBackoffRetry(alluxio.retry.ExponentialBackoffRetry) MountPointInfo(alluxio.wire.MountPointInfo) HashMap(java.util.HashMap) NetworkAddressUtils(alluxio.util.network.NetworkAddressUtils) AgentManagerServiceGrpc(alluxio.hub.proto.AgentManagerServiceGrpc) ListFileResponse(alluxio.hub.proto.ListFileResponse) Function(java.util.function.Function) SpeedStat(alluxio.hub.proto.SpeedStat) WriteConfigurationSetResponse(alluxio.hub.proto.WriteConfigurationSetResponse) ExecutionType(alluxio.hub.proto.ExecutionType) AlluxioNodeType(alluxio.hub.proto.AlluxioNodeType) PrestoCatalogListingResult(alluxio.hub.proto.PrestoCatalogListingResult) PathUtils(alluxio.util.io.PathUtils) ImmutableList(com.google.common.collect.ImmutableList) HDFSMountPointInfo(alluxio.hub.proto.HDFSMountPointInfo) AlluxioStatusException(alluxio.exception.status.AlluxioStatusException) AlluxioEdition(alluxio.hub.proto.AlluxioEdition) ExecutorService(java.util.concurrent.ExecutorService) RegisterAgentRequest(alluxio.hub.proto.RegisterAgentRequest) Logger(org.slf4j.Logger) Iterator(java.util.Iterator) ReentrantLock(java.util.concurrent.locks.ReentrantLock) AgentRemoveFileRequest(alluxio.hub.proto.AgentRemoveFileRequest) ApplyMountPointRequest(alluxio.hub.proto.ApplyMountPointRequest) GetPrestoConfDirRequest(alluxio.hub.proto.GetPrestoConfDirRequest) ThreadFactoryUtils(alluxio.util.ThreadFactoryUtils) Pair(alluxio.collections.Pair) UploadFileRequest(alluxio.hub.proto.UploadFileRequest) HubStatus(alluxio.hub.proto.HubStatus) ConfigurationUtils(alluxio.util.ConfigurationUtils) HubSslContextProvider(alluxio.hub.common.HubSslContextProvider) ProcessStatusChangeRequest(alluxio.hub.proto.ProcessStatusChangeRequest) WriteConfigurationSetRequest(alluxio.hub.proto.WriteConfigurationSetRequest) FileSystemContext(alluxio.client.file.FileSystemContext) ListFileRequest(alluxio.hub.proto.ListFileRequest) KubernetesClient(io.fabric8.kubernetes.client.KubernetesClient) VisibleForTesting(com.google.common.annotations.VisibleForTesting) ConfigBuilder(io.fabric8.kubernetes.client.ConfigBuilder) ListMountPointRequest(alluxio.hub.proto.ListMountPointRequest) Collections(java.util.Collections) SpeedTestParameter(alluxio.hub.proto.SpeedTestParameter) ByteString(com.google.protobuf.ByteString) AlluxioNodeType(alluxio.hub.proto.AlluxioNodeType)

Aggregations

AlluxioURI (alluxio.AlluxioURI)1 RuntimeConstants (alluxio.RuntimeConstants)1 ValidationUtils (alluxio.cli.ValidationUtils)1 FileSystem (alluxio.client.file.FileSystem)1 FileSystemContext (alluxio.client.file.FileSystemContext)1 Pair (alluxio.collections.Pair)1 AlluxioConfiguration (alluxio.conf.AlluxioConfiguration)1 AlluxioProperties (alluxio.conf.AlluxioProperties)1 InstancedConfiguration (alluxio.conf.InstancedConfiguration)1 PropertyKey (alluxio.conf.PropertyKey)1 ServerConfiguration (alluxio.conf.ServerConfiguration)1 Source (alluxio.conf.Source)1 CLUSTER_DEFAULT (alluxio.conf.Source.CLUSTER_DEFAULT)1 AlluxioException (alluxio.exception.AlluxioException)1 FileDoesNotExistException (alluxio.exception.FileDoesNotExistException)1 InvalidPathException (alluxio.exception.InvalidPathException)1 AlluxioStatusException (alluxio.exception.status.AlluxioStatusException)1 GrpcChannel (alluxio.grpc.GrpcChannel)1 MountPOptions (alluxio.grpc.MountPOptions)1 HubSslContextProvider (alluxio.hub.common.HubSslContextProvider)1