Saving results to a bucket/blob in the cloud via the Python SDK

Hello,

I am trying to figure out how I can download results from a ODMNode running on a VM in the Azure cloud to a blob in Azure cloud via the python SDK. Is this supported?

Basically, download the result from a node to a url location instead of local dir.

I am trying to do that through a serverless function which might add some complexity.

Best Regards,
Rasmus

1 Like

Welcome!

Great question! Well beyond me unfortunately. Hopefully someone else comes by soon.

I know most current work is done in/around AWS and DigitalOcean. Not sure if anyone contributed code for Azure yet.

Hello,

Thank you! :slight_smile:

I understand, I have seen that AWS is mentioned in documentation and in the forum.

As of now I am trying to download it locally via the Function and then upload it to a bucket/blob. Works when I test on my computer but have to see how it works out deployed in the cloud.

Best Regards,
Rasmus

1 Like

I managed to to this by using tmp folder in the Azure function and then upload the result to the blob:

Python developer reference for Azure Functions | Microsoft Docs

#set tmp to variable zip_dir
    zip_dir = tempfile.gettempdir()

#download the zip result and save it to variable blob_path
    blob_path = task.download_zip(zip_dir)

#create a blob name
    blob = "result_" + uuid1+ ".zip"

#finally upload the blob, could be done with output parameter as well.
    blob_service.create_blob_from_path(top_level_container_name, blob, blob_path)

Best Regards,
Rasmus

1 Like