1
0
mirror of https://github.com/newnius/YAO-Dockerfiles.git synced 2025-12-13 09:36:43 +00:00
This commit is contained in:
2020-05-04 15:19:25 +08:00
parent 074cfd78da
commit ffb131a0d3
6 changed files with 47 additions and 3 deletions

View File

@@ -0,0 +1,20 @@
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)
print('Save ' + output_dir + 'to' + hdfs_address + ' ' + hdfs_dir)
except Exception as e:
print('Unable to persist data to HDFS,', str(e))