use of io.hops.hopsworks.dela.old_dto.TorrentId in project hopsworks by logicalclocks.
the class TransferDelaController method upload.
public void upload(String publicDSId, HopsDatasetDetailsDTO datasetDetails, HDFSResource resource, HDFSEndpoint endpoint) throws DelaException {
if (!delaStateController.transferDelaAvailable()) {
throw new DelaException(RESTCodes.DelaErrorCode.DELA_TRANSFER_NOT_AVAILABLE, Level.SEVERE, DelaException.Source.LOCAL);
}
logger.log(Settings.DELA_DEBUG, "{0} upload - transfer");
HopsTorrentUpload reqContent = new HopsTorrentUpload(new TorrentId(publicDSId), datasetDetails.getDatasetName(), datasetDetails.getProjectId(), datasetDetails.getDatasetId(), resource, endpoint);
try {
ClientWrapper<SuccessJSON> rc = ClientWrapper.httpInstance(SuccessJSON.class).setTarget(settings.getDELA_TRANSFER_HTTP_ENDPOINT()).setPath("torrent/hops/upload/xml").setPayload(reqContent);
SuccessJSON result = rc.doPost();
} catch (IllegalStateException ise) {
logger.log(Level.WARNING, "dela communication fail:{0}", ise.getMessage());
throw new DelaException(RESTCodes.DelaErrorCode.COMMUNICATION_FAILURE, Level.SEVERE, DelaException.Source.DELA, null, ise.getMessage(), ise);
}
}
use of io.hops.hopsworks.dela.old_dto.TorrentId in project hopsworks by logicalclocks.
the class TransferDelaController method advanceDownload.
public void advanceDownload(String publicDSId, HDFSEndpoint hdfsEndpoint, KafkaEndpoint kafkaEndpoint, ExtendedDetails details) throws DelaException {
if (!delaStateController.transferDelaAvailable()) {
throw new DelaException(RESTCodes.DelaErrorCode.DELA_TRANSFER_NOT_AVAILABLE, Level.SEVERE, DelaException.Source.LOCAL);
}
HopsTorrentAdvanceDownload reqContent = new HopsTorrentAdvanceDownload(new TorrentId(publicDSId), kafkaEndpoint, hdfsEndpoint, details);
try {
ClientWrapper<SuccessJSON> rc = ClientWrapper.httpInstance(SuccessJSON.class).setTarget(settings.getDELA_TRANSFER_HTTP_ENDPOINT()).setPath("torrent/hops/download/advance/xml").setPayload(reqContent);
SuccessJSON result = rc.doPost();
} catch (IllegalStateException ise) {
logger.log(Level.WARNING, "dela communication fail:{0}", ise.getMessage());
throw new DelaException(RESTCodes.DelaErrorCode.COMMUNICATION_FAILURE, Level.SEVERE, DelaException.Source.DELA, null, ise.getMessage(), ise);
}
}
use of io.hops.hopsworks.dela.old_dto.TorrentId in project hopsworks by logicalclocks.
the class DelaProjectService method getExtendedDetails.
@GET
@Path("/transfers/{publicDSId}")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@AllowedProjectRoles({ AllowedProjectRoles.DATA_SCIENTIST, AllowedProjectRoles.DATA_OWNER })
@JWTRequired(acceptedTokens = { Audience.API }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
public Response getExtendedDetails(@PathParam("publicDSId") String publicDSId, @Context SecurityContext sc) throws DelaException {
TorrentId torrentId = new TorrentId(publicDSId);
TorrentExtendedStatusJSON resp = delaTransferCtrl.details(torrentId);
return successResponse(resp);
}
use of io.hops.hopsworks.dela.old_dto.TorrentId in project hopsworks by logicalclocks.
the class TransferDelaController method startDownload.
public void startDownload(String publicDSId, HopsDatasetDetailsDTO datasetDetails, HDFSResource resource, HDFSEndpoint endpoint, List<ClusterAddressDTO> bootstrap) throws DelaException {
if (!delaStateController.transferDelaAvailable()) {
throw new DelaException(RESTCodes.DelaErrorCode.DELA_TRANSFER_NOT_AVAILABLE, Level.SEVERE, DelaException.Source.LOCAL);
}
List<AddressJSON> bootstrapAdr = new LinkedList<>();
Gson gson = new Gson();
for (ClusterAddressDTO b : bootstrap) {
bootstrapAdr.add(gson.fromJson(b.getDelaTransferAddress(), AddressJSON.class));
}
HopsTorrentStartDownload reqContent = new HopsTorrentStartDownload(new TorrentId(publicDSId), datasetDetails.getDatasetName(), datasetDetails.getProjectId(), datasetDetails.getDatasetId(), resource, bootstrapAdr, endpoint);
try {
ClientWrapper<SuccessJSON> rc = ClientWrapper.httpInstance(SuccessJSON.class).setTarget(settings.getDELA_TRANSFER_HTTP_ENDPOINT()).setPath("torrent/hops/download/start/xml").setPayload(reqContent);
SuccessJSON result = rc.doPost();
} catch (IllegalStateException ise) {
logger.log(Level.WARNING, "dela communication fail:{0}", ise.getMessage());
throw new DelaException(RESTCodes.DelaErrorCode.COMMUNICATION_FAILURE, Level.SEVERE, DelaException.Source.DELA, null, ise.getMessage(), ise);
}
}
use of io.hops.hopsworks.dela.old_dto.TorrentId in project hopsworks by logicalclocks.
the class TransferDelaController method cancel.
public void cancel(String publicDSId) throws DelaException {
if (!delaStateController.transferDelaAvailable()) {
throw new DelaException(RESTCodes.DelaErrorCode.DELA_TRANSFER_NOT_AVAILABLE, Level.SEVERE, DelaException.Source.LOCAL);
}
try {
ClientWrapper<SuccessJSON> rc = ClientWrapper.httpInstance(SuccessJSON.class).setTarget(settings.getDELA_TRANSFER_HTTP_ENDPOINT()).setPath("torrent/hops/stop").setPayload(new TorrentId(publicDSId));
SuccessJSON result = rc.doPost();
} catch (IllegalStateException ise) {
throw new DelaException(RESTCodes.DelaErrorCode.COMMUNICATION_FAILURE, Level.SEVERE, DelaException.Source.DELA, null, ise.getMessage(), ise);
}
}
Aggregations