Search in sources :

Example 1 with RegisterManagerResponse

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

the class ManagerProcessContext method connectToHub.

private void connectToHub(alluxio.hub.proto.AlluxioCluster cluster) throws Exception {
    // initialize manager with Hub before setting up bi-di connections
    LOG.info("Connecting to Hub...");
    // Max time ~(retry time) in seconds
    long retryTimeMs = mConf.getMs(PropertyKey.HUB_MANAGER_REGISTER_RETRY_TIME);
    RetryPolicy retry = new ExponentialBackoffRetry(50, 1000, (int) (retryTimeMs / 1000));
    while (retry.attempt()) {
        try {
            RegisterManagerResponse response = mHostedClient.get().registerManager(RegisterManagerRequest.newBuilder().setHubMetadata(mHubMetadata).setPayload(RegisterManagerRequest.Payload.newBuilder().setAlluxioCluster(cluster)).build());
            Preconditions.checkArgument(response.getPayload().getStatus().equals(HubStatus.MANAGER_START_CONNECTION), "Missing status in registerManager response");
        } catch (Throwable t) {
            handleStatusRuntimeException("Failed trying to register manager with Hosted Hub", t);
            continue;
        }
        startPingManagerListener();
        startProcessStatusChangeListener();
        startGetConfigurationSetListener();
        startWriteConfigurationSetListener();
        startUploadFileListener();
        startListFileListener();
        startRemoveFileListener();
        startDetectPrestoListener();
        startListCatalogListener();
        startSetPrestoConfDirListener();
        startGetPrestoConfDirListener();
        startListMountPointsListener();
        startApplyMountPointListener();
        startDeleteMountPointListener();
        startSpeedTestListener();
        LOG.info("Connected to Hub.");
        return;
    }
    throw new Exception(String.format("Failed to connect to Hub after %s attempts", retry.getAttemptCount()));
}
Also used : ExponentialBackoffRetry(alluxio.retry.ExponentialBackoffRetry) RegisterManagerResponse(alluxio.hub.proto.RegisterManagerResponse) RetryPolicy(alluxio.retry.RetryPolicy) AlluxioException(alluxio.exception.AlluxioException) IOException(java.io.IOException) InvalidPathException(alluxio.exception.InvalidPathException) FileDoesNotExistException(alluxio.exception.FileDoesNotExistException) AlluxioStatusException(alluxio.exception.status.AlluxioStatusException)

Aggregations

AlluxioException (alluxio.exception.AlluxioException)1 FileDoesNotExistException (alluxio.exception.FileDoesNotExistException)1 InvalidPathException (alluxio.exception.InvalidPathException)1 AlluxioStatusException (alluxio.exception.status.AlluxioStatusException)1 RegisterManagerResponse (alluxio.hub.proto.RegisterManagerResponse)1 ExponentialBackoffRetry (alluxio.retry.ExponentialBackoffRetry)1 RetryPolicy (alluxio.retry.RetryPolicy)1 IOException (java.io.IOException)1