Plotting the task graph
You are trying to analyze your company's spending records. Your manager wants to see what fraction of the total spending occurred in each month. But you are going to have to run it for many files, so it would be good to set up a lazy calculation so you can speed it up using threads or processes. To figure out which of these task scheduling methods might be better for this calculation, you would like to visualize the task graph.
The totals spent in two months are available for you as delayed objects as month_1_costs and month_2_costs. dask has also been imported for you.
Deze oefening maakt deel uit van de cursus
Parallel Programming with Dask in Python
Oefeninstructies
- Calculate the total spend from the two months.
- Find the fraction of the total which was spent in the first month.
- Find the fraction of the total which was spent in the second month.
- Visualize the joint task graph used to compute
month_1_fractionandmonth_2_fraction.
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
# Add the two delayed month costs
total_costs = ____
# Calculate the fraction of total cost from month 1
month_1_fraction = ____
# Calculate the fraction of total cost from month 2
month_2_fraction = ____
# Plot the joint task graph used to calculate the fractions
____