You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/11/22 06:50:17 UTC
[GitHub] [arrow] apache135 commented on issue #14268: [pyarrow] significant increase in memory when connect hdfs and upload files to hdfs
apache135 commented on issue #14268:
URL: https://github.com/apache/arrow/issues/14268#issuecomment-1323193721
Here is the code:
`import os
import time
import psutil
import pyarrow as pa
def get_hdfs_client():
ticket_path = "/tmp/krb5cc_3004"
return pa.hdfs.connect(user=os.getenv('FI_KAFKA_USER'), kerb_ticket=ticket_path)
def upload(hdfs_client):
local_upload_path = "/tmp/lvtest/python399.zip"
hdfs_path = "/tmp/python399.zip"
try:
with open(local_upload_path, "rb") as f_stream:
hdfs_client.upload(hdfs_path, f_stream, buffer_size=128*1024*1024)
except Exception as e:
print(f"upload {hdfs_path} fail: {e}")
print("upload: ok")
time.sleep(1)
try:
hdfs_client.rm(hdfs_path)
except Exception as e:
print(f"rm {hdfs_path} fail: {e}")
# del file
# gc.collect()
if __name__ == '__main__':
print('========= test start ========')
start_memory = psutil.Process(os.getpid()).memory_info().rss / 1024 / 1024
hdfs_client = get_hdfs_client()
after_get_client_memory = psutil.Process(os.getpid()).memory_info().rss / 1024 / 1024
print(fr"test done. start memory: {start_memory}, "
fr"get hdfs client: end memory: {after_get_client_memory}")
upload(hdfs_client)
print(fr"finish upload,end memory: {psutil.Process(os.getpid()).memory_info().rss / 1024 / 1024}")
time.sleep(60)`
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org