DImuthuUpe commented on issue #92:
URL: https://github.com/apache/airavata-mft/issues/92#issuecomment-1478239914
Great. Looks like MFT running fine now. You might have to get a pull of the
MFT repository and rebuild through maven before moving into next step. After
you have MFT built,
1. Run `mft storage add` to add both SCP and S3 endpoints. This is a
one-time step and you can reuse the storage you have added in multiple
transfers.
2. Run `mft storage list` to list the storages you have already registered.
Notice that there is a storage id for each storage.
Here is the java code to submit transfers for the storage you have added.
You need to replace storage ids with the ids you got
`
package org.apache.airavata.mft.api.client;
import org.apache.airavata.mft.api.service.*;
import
org.apache.airavata.mft.resource.stubs.storage.common.SecretForStorage;
import
org.apache.airavata.mft.resource.stubs.storage.common.SecretForStorageGetRequest;
public class Test {
public static void main(String args[]) throws InterruptedException {
String s3StorageId = "07e4865f-7b35-4c8d-a977-81c5ba0f6ff4";
String scpStorageId = "5344d7f6-1ab6-458b-8e15-47108d7b5ead";
String scpSourcePath = "/home/exouser/a.txt";
String s3DestinationPath = "a.txt";
MFTApiClient client = MFTApiClient.MFTApiClientBuilder.newBuilder()
.withResourceServicePort(7003)
.withSecretServicePort(7003)
.withTransferServicePort(7003).build();
SecretForStorage scpSecret = client.getStorageServiceClient()
.common()
.getSecretForStorage(SecretForStorageGetRequest.newBuilder().setStorageId(scpStorageId).build());
SecretForStorage s3Secret = client.getStorageServiceClient()
.common()
.getSecretForStorage(SecretForStorageGetRequest.newBuilder().setStorageId(s3StorageId).build());
EndpointPaths endpoints = EndpointPaths.newBuilder()
.setSourcePath(scpSourcePath)
.setDestinationPath(s3DestinationPath).build();
TransferApiResponse transferResponse =
client.getTransferClient().submitTransfer(TransferApiRequest.newBuilder()
.setSourceSecretId(scpSecret.getSecretId())
.setSourceStorageId(scpStorageId).setDestinationSecretId(s3Secret.getSecretId())
.setDestinationStorageId(s3StorageId).addEndpointPaths(endpoints).build()); //
You can a many endpointpaths into one request
String transferId = transferResponse.getTransferId();
System.out.println("Transfer Id: " + transferId);
// Monitoring transfer progress. You can write your own logic to do
this
for (int i = 0; i < 10; i ++) {
TransferStateSummaryResponse transferStateSummary =
client.getTransferClient()
.getTransferStateSummary(
TransferStateApiRequest.newBuilder().setTransferId(transferId).build());
System.out.println("Transfer state: " +
transferStateSummary.getState());
Thread.sleep(1000);
}
}
}
`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]