cdmikechen commented on code in PR #989:
URL: https://github.com/apache/submarine/pull/989#discussion_r951264418
##########
submarine-experiment-prehandler/fs_prehandler/hdfs_prehandler.py:
##########
@@ -15,26 +15,39 @@
import logging
import os
+import subprocess
from fs_prehandler import FsPreHandler
from fsspec.implementations.arrow import HadoopFileSystem
class HDFSPreHandler(FsPreHandler):
def __init__(self):
self.hdfs_host=os.environ['HDFS_HOST']
- self.hdfs_port=int(os.environ['HDFS_PORT'])
+ self.hdfs_port=os.environ['HDFS_PORT']
self.hdfs_source=os.environ['HDFS_SOURCE']
self.dest_path=os.environ['DEST_PATH']
self.enable_kerberos=os.environ['ENABLE_KERBEROS']
+ self.hadoop_home=os.environ['HADOOP_HOME']
+ self.dest_minio_host=os.environ['DEST_MINIO_HOST']
+ self.dest_minio_port=os.environ['DEST_MINIO_PORT']
+ self.minio_access_key=os.environ['MINIO_ACCESS_KEY']
+ self.minio_secert_key=os.environ['MINIO_SECRET_KEY']
logging.info('HDFS_HOST:%s' % self.hdfs_host)
- logging.info('HDFS_PORT:%d' % self.hdfs_port)
+ logging.info('HDFS_PORT:%s' % self.hdfs_port)
logging.info('HDFS_SOURCE:%s' % self.hdfs_source)
+ logging.info('MINIO_DEST_HOST:%s' % self.dest_minio_host)
+ logging.info('MINIO_DEST_PORT:%s' % self.dest_minio_port)
logging.info('DEST_PATH:%s' % self.dest_path)
logging.info('ENABLE_KERBEROS:%s' % self.enable_kerberos)
- self.fs = HadoopFileSystem(host=self.hdfs_host, port=self.hdfs_port)
-
def process(self):
- self.fs.get(self.hdfs_source, self.dest_path, recursive=True)
+
+ p = subprocess.run([self.hadoop_home+'/bin/hadoop', 'distcp'
+ , '-Dfs.s3a.endpoint=http://' + self.dest_minio_host + ':' +
self.dest_minio_port + '/'
Review Comment:
I have tested it and found that we need to add
`-Dfs.s3a.path.style.access=true`, otherwise the map step will be stuck at 4%
My test command is this and it works:
```
./hadoop distcp -Dfs.s3a.path.style.access=true
-Dfs.s3a.endpoint=http://xxx:9000 -Dfs.s3a.access.key=xxx
-Dfs.s3a.secret.key=xxx hdfs://${HDFS_HOST}:${HDFS_PORT}/upload/admin
s3a://hdfs-back/
```
--
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]