Aan de slagGa gratis aan de slag

Constructing custom Dask bags

A common use case for Dask bags is to convert some code you have already written to run in parallel. Depending on the code, sometimes it can be easier to construct lists of delayed objects and then convert them to a bag. Other times it will be easier to form a Dask bag early on in the code and map functions over it. Which of these options is easier will depend on your exact code, so it's important that you know how to use either method.

dask has been imported for you, and dask.bag has been imported as db. A list of file names strings is available in your environment as wavfiles.

Deze oefening maakt deel uit van de cursus

Parallel Programming with Dask in Python

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Convert the list of filenames into a Dask bag
filename_bag = ____

# Apply the load_wav() function to each element of the bag
loaded_audio_bag = ____
Code bewerken en uitvoeren