use of com.logicalclocks.servicediscoverclient.service.Service in project hopsworks by logicalclocks.
the class HopsfsTrainingDatasetController method convertHopsfsTrainingDatasetToDTO.
/**
* Converts a Hopsfs Training Dataset entity into a DTO representation
*
* @param trainingDataset the entity to convert
* @return the converted DTO representation
*/
public TrainingDatasetDTO convertHopsfsTrainingDatasetToDTO(TrainingDatasetDTO trainingDatasetDTO, TrainingDataset trainingDataset) throws ServiceException {
Service namenodeService;
try {
namenodeService = serviceDiscoveryController.getAnyAddressOfServiceWithDNS(ServiceDiscoveryController.HopsworksService.RPC_NAMENODE);
} catch (ServiceDiscoveryException e) {
throw new ServiceException(RESTCodes.ServiceErrorCode.SERVICE_NOT_FOUND, Level.SEVERE, "Could not find namenode service", e.getMessage(), e);
}
HopsfsTrainingDataset hopsfsTrainingDataset = trainingDataset.getHopsfsTrainingDataset();
trainingDatasetDTO.setLocation(new Path(DistributedFileSystemOps.HOPSFS_SCHEME, namenodeService.getAddress() + ":" + namenodeService.getPort(), inodeController.getPath(hopsfsTrainingDataset.getInode())).toString());
trainingDatasetDTO.setInodeId(hopsfsTrainingDataset.getInode().getId());
FeaturestoreHopsfsConnectorDTO hopsfsConnectorDTO = new FeaturestoreHopsfsConnectorDTO(hopsfsTrainingDataset.getFeaturestoreConnector());
trainingDatasetDTO.setStorageConnector(hopsfsConnectorDTO);
return trainingDatasetDTO;
}
use of com.logicalclocks.servicediscoverclient.service.Service in project hopsworks by logicalclocks.
the class Settings method getAlertManagerService.
private static Optional<Service> getAlertManagerService(String serviceFQDN) throws ServiceDiscoveryException {
ServiceDiscoveryClient client = null;
Optional<Service> services;
try {
client = new Builder(Type.DNS).build();
String name = Strings.isNullOrEmpty(serviceFQDN) ? DEFAULT_ALERTMANAGER_FQDN : serviceFQDN;
services = client.getService(ServiceQuery.of(name, Collections.emptySet())).findFirst();
} finally {
if (client != null) {
client.close();
}
}
return services;
}
Aggregations