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
.
Diese Übung ist Teil des Kurses
Parallel Programming with Dask in Python
Interaktive Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
# 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 = ____