github.com/NVIDIA/aistore@v1.3.23-0.20240517131212-7df6609be51d/python/examples/ais-etl/etl_md5_hpush.py (about) 1 """ 2 ETL to calculate md5 of an object. 3 Communication Type: hpush:// 4 5 Copyright (c) 2022-2023, NVIDIA CORPORATION. All rights reserved. 6 """ 7 8 import hashlib 9 from aistore import Client 10 from aistore.sdk import Bucket 11 12 client = Client("http://192.168.49.2:8080") 13 14 15 def transform(input_bytes): 16 md5 = hashlib.md5() 17 md5.update(input_bytes) 18 return md5.hexdigest().encode() 19 20 21 client.etl("etl-md5").init_code(transform=transform) 22 23 job_id = client.bucket("from-bck").transform( 24 etl_name="etl-md5", to_bck=Bucket("to-bck"), ext={"jpg": "txt"} 25 ) 26 client.job(job_id).wait()