1
0
mirror of https://github.com/newnius/YAO-Dockerfiles.git synced 2025-12-16 10:26:44 +00:00
Files

21 lines
516 B
Python
Raw Permalink Normal View History

2020-05-04 15:19:25 +08:00
from hdfs import *
import os
import time
if __name__ == '__main__':
os.environ["TZ"] = 'Asia/Shanghai'
if hasattr(time, 'tzset'):
time.tzset()
try:
hdfs_address = os.environ['hdfs_address']
hdfs_dir = os.environ['hdfs_dir']
output_dir = os.environ['output_dir']
client = Client(hdfs_address)
client.upload(hdfs_dir, output_dir)
2020-07-02 21:16:22 +08:00
print('Save ' + output_dir + ' to' + hdfs_address + ' ' + hdfs_dir)
2020-05-04 15:19:25 +08:00
except Exception as e:
print('Unable to persist data to HDFS,', str(e))