I am new to Azure, Python and Asynchronous programming.
I have a situation where I need to do some heavy tasks (in this case, creating snapshots for Azure's managed disks)
I have something like:
def create_snapshot():
for VM in list_of_virtual_machines:
snapshot = compute_client.snapshots.begin_create_or_update(VM.name, VM.location).result() # asynchronous task
# Do something with the snapshot once it is ready, in the meantime, continue creating other virtual machines' snapshots
How do I write code for this situation, and which method should I choose? Threading, Asyncio etc. ? My question might be unclear and vague since I am new to these concepts.
Any help is appreciated. Thanks in advance.