You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@airavata.apache.org by "praneethchityala (via GitHub)" <gi...@apache.org> on 2023/03/18 05:46:44 UTC

[GitHub] [airavata-mft] praneethchityala opened a new pull request, #91: Local transport v2 and other fixes

praneethchityala opened a new pull request, #91:
URL: https://github.com/apache/airavata-mft/pull/91

   This PR has 5 updates as follows:
   
   - [gRPC ports config](https://github.com/apache/airavata-mft/commit/12dc6e7b2b50e3b70927403bc8c91446ce5df9b6)
     - Added config file to update ports for transfer_api, resource service and secret service
   - [Local incoming streamer added](https://github.com/apache/airavata-mft/commit/a19b4201a4dbfd216e26fc6f021b3d183e57bbc9)
     - Implemented incoming streaming connector for local transport
   - [Local incoming chunked update](https://github.com/apache/airavata-mft/commit/dedc153d90a9e9c1f1e0ad42f70d627f27ffff17)
     - Updated local incoming chunked connector code for efficiency
   - [S3 Outgoing bufferStreaming update](https://github.com/apache/airavata-mft/commit/3664e4e9db5548cc14c7ce15f29d81b8ce49ea4d)
     - Updated from file to use Buffered Streaming
   - [consul update to accept all](https://github.com/apache/airavata-mft/commit/58e7f52f5704375f6d9beacd04ef4ad3cb274906)
     - Allowed to consul to connect with all ip addresses


-- 
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: issues-unsubscribe@airavata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airavata-mft] DImuthuUpe merged pull request #91: Local transport v2 and other fixes

Posted by "DImuthuUpe (via GitHub)" <gi...@apache.org>.
DImuthuUpe merged PR #91:
URL: https://github.com/apache/airavata-mft/pull/91


-- 
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: issues-unsubscribe@airavata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airavata-mft] DImuthuUpe commented on a diff in pull request #91: Local transport v2 and other fixes

Posted by "DImuthuUpe (via GitHub)" <gi...@apache.org>.
DImuthuUpe commented on code in PR #91:
URL: https://github.com/apache/airavata-mft/pull/91#discussion_r1141156866


##########
transport/local-transport/src/main/java/org/apache/airavata/mft/transport/local/LocalIncomingChunkedConnector.java:
##########
@@ -53,45 +55,40 @@ public void failed() throws Exception {
     @Override
     public void downloadChunk(int chunkId, long startByte, long endByte, String downloadFile) throws Exception {
 
-        FileInputStream from = new FileInputStream(new File(this.resourcePath));
-        FileOutputStream to = new FileOutputStream(new File(downloadFile));
-
-        final int buffLen = 1024;
-
-        byte[] buf = new byte[buffLen];
-
-        from.skip(startByte);
-
-        long fileSize = endByte - startByte + 1;
-
-        while (true) {
-            int bufSize = 0;
-
-            if (buffLen < fileSize) {
-                bufSize = buffLen;
-            } else {
-                bufSize = (int) fileSize;
-            }
-
-            bufSize = (int) from.read(buf, 0, bufSize);
-
-            if (bufSize < 0) {
-                break;
-            }
-
-            to.write(buf, 0, bufSize);
-            to.flush();
-
-            fileSize -= bufSize;
-
-            if (fileSize == 0L) {
-                break;
+        logger.info("Downloading chunk {} with start byte {} and end byte {} to file {} from resource path {}",
+                chunkId, startByte, endByte, downloadFile, this.resourcePath);
+
+//        #use this code on a DMA enabled device

Review Comment:
   Make this configurable through a property



##########
transport/local-transport/src/main/java/org/apache/airavata/mft/transport/local/LocalIncomingChunkedConnector.java:
##########
@@ -53,45 +55,40 @@ public void failed() throws Exception {
     @Override
     public void downloadChunk(int chunkId, long startByte, long endByte, String downloadFile) throws Exception {
 
-        FileInputStream from = new FileInputStream(new File(this.resourcePath));
-        FileOutputStream to = new FileOutputStream(new File(downloadFile));
-
-        final int buffLen = 1024;
-
-        byte[] buf = new byte[buffLen];
-
-        from.skip(startByte);
-
-        long fileSize = endByte - startByte + 1;
-
-        while (true) {
-            int bufSize = 0;
-
-            if (buffLen < fileSize) {
-                bufSize = buffLen;
-            } else {
-                bufSize = (int) fileSize;
-            }
-
-            bufSize = (int) from.read(buf, 0, bufSize);
-
-            if (bufSize < 0) {
-                break;
-            }
-
-            to.write(buf, 0, bufSize);
-            to.flush();
-
-            fileSize -= bufSize;
-
-            if (fileSize == 0L) {
-                break;
+        logger.info("Downloading chunk {} with start byte {} and end byte {} to file {} from resource path {}",
+                chunkId, startByte, endByte, downloadFile, this.resourcePath);
+
+//        #use this code on a DMA enabled device
+//        if (resourceSize <= endByte - startByte) {
+//            Files.copy(Path.of(this.resourcePath), Path.of(downloadFile));
+//        } else {
+//            try (FileInputStream from = new FileInputStream(this.resourcePath);
+//                 FileOutputStream to = new FileOutputStream(downloadFile)) {
+//                from.getChannel().transferTo(startByte, endByte - startByte, to.getChannel());
+//            } catch (Exception e) {
+//                logger.error("Unexpected error occurred while downloading chunk {} to file {} from resource path {}",
+//                        chunkId, downloadFile, this.resourcePath, e);
+//                throw e;
+//            }
+//        }
+
+        int buffLen = 1024 * 1024 * 16;

Review Comment:
   Make this a configurable value



-- 
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: issues-unsubscribe@airavata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airavata-mft] DImuthuUpe commented on pull request #91: Local transport v2 and other fixes

Posted by "DImuthuUpe (via GitHub)" <gi...@apache.org>.
DImuthuUpe commented on PR #91:
URL: https://github.com/apache/airavata-mft/pull/91#issuecomment-1474992187

   BTW, I am going to merge this as the changes required for this PR will impose mft core changes. @praneethchityala please send a different PR for that.


-- 
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: issues-unsubscribe@airavata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org