Search in sources :

Example 1 with HopsTorrentUpload

use of io.hops.hopsworks.dela.old_dto.HopsTorrentUpload 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);
    }
}
Also used : TorrentId(io.hops.hopsworks.dela.old_dto.TorrentId) HopsTorrentUpload(io.hops.hopsworks.dela.old_dto.HopsTorrentUpload) SuccessJSON(io.hops.hopsworks.dela.old_dto.SuccessJSON) DelaException(io.hops.hopsworks.exceptions.DelaException)

Aggregations

HopsTorrentUpload (io.hops.hopsworks.dela.old_dto.HopsTorrentUpload)1 SuccessJSON (io.hops.hopsworks.dela.old_dto.SuccessJSON)1 TorrentId (io.hops.hopsworks.dela.old_dto.TorrentId)1 DelaException (io.hops.hopsworks.exceptions.DelaException)1