use of alluxio.grpc.UfsInfo in project alluxio by Alluxio.
the class JobUfsManager method get.
@Override
public UfsClient get(long mountId) throws NotFoundException, UnavailableException {
try {
return super.get(mountId);
} catch (NotFoundException e) {
// Not cached locally, let's query master
}
UfsInfo info;
try {
info = mMasterClient.getUfsInfo(mountId);
} catch (IOException e) {
throw new UnavailableException(String.format("Failed to create UFS info for mount point with id %d", mountId), e);
}
Preconditions.checkState((info.hasUri() && info.hasProperties()), "unknown mountId");
super.addMount(mountId, new AlluxioURI(info.getUri()), UnderFileSystemConfiguration.defaults(ServerConfiguration.global()).setReadOnly(info.getProperties().getReadOnly()).setShared(info.getProperties().getShared()).createMountSpecificConf(info.getProperties().getPropertiesMap()));
UfsClient ufsClient = super.get(mountId);
try (CloseableResource<UnderFileSystem> ufsResource = ufsClient.acquireUfsResource()) {
UnderFileSystem ufs = ufsResource.get();
ufs.connectFromWorker(NetworkAddressUtils.getConnectHost(NetworkAddressUtils.ServiceType.WORKER_RPC, ServerConfiguration.global()));
} catch (IOException e) {
removeMount(mountId);
throw new UnavailableException(String.format("Failed to connect to UFS %s with id %d", info.getUri(), mountId), e);
}
return ufsClient;
}
use of alluxio.grpc.UfsInfo in project alluxio by Alluxio.
the class WorkerUfsManager method get.
/**
* {@inheritDoc}.
*
* If this mount id is new to this worker, this method will query master to get the
* corresponding ufs info.
*/
@Override
public UfsClient get(long mountId) throws NotFoundException, UnavailableException {
try {
return super.get(mountId);
} catch (NotFoundException e) {
// Not cached locally, let's query master
}
UfsInfo info;
try {
info = mMasterClient.getUfsInfo(mountId);
} catch (IOException e) {
throw new UnavailableException(String.format("Failed to create UFS info for mount point with id %d", mountId), e);
}
Preconditions.checkState((info.hasUri() && info.hasProperties()), "unknown mountId");
super.addMount(mountId, new AlluxioURI(info.getUri()), UnderFileSystemConfiguration.defaults(ServerConfiguration.global()).setReadOnly(info.getProperties().getReadOnly()).setShared(info.getProperties().getShared()).createMountSpecificConf(info.getProperties().getPropertiesMap()));
UfsClient ufsClient = super.get(mountId);
return ufsClient;
}
Aggregations