apache135 commented on issue #14268:
URL: https://github.com/apache/arrow/issues/14268#issuecomment-1323197541
```
import os
import time
import psutil
import pyarrow as pa
def get_hdfs_client():
ticket_path = "/tmp/krb5cc_3114"
return pa.hdfs.connect(user=os.getenv('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}")
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)
```
Here is the result:
test done. start memory: 54.19921875, get hdfs client: end memory:
394.4609375
upload: ok
finish upload,end memory: 2731.8046875
--
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]