Repository navigation
Avoid using Delayed in to_csv and to_parquet - #7968
Conversation
This accomplishes two things:
1. Lets dataframe optimizations through
2. Avoids a final synchronization point in the graph
which improves scheduling heuristics
| if compute: | ||
| import dask | ||
|
|
||
| dask.compute(*part_tasks, **{compute_kwargs or {}}) |
There was a problem hiding this comment.
I think part_tasks is still just a list of keys. dsk is where the actual tasks are
There was a problem hiding this comment.
yeah, I'm iterating on this. Stay tuned!
There was a problem hiding this comment.
Actually, see recent commit I think
There was a problem hiding this comment.
And the edit in the top comment
|
OK, so I'm doing something dumb with parquet, but after staring at it for 20m I'm hoping that @rjzamora can help me out. I do generally think that this is a good direction to go in though. It's also probably something that we should watch out for. |
Interesting! I was actually unaware of |
Yeah, I had totally forgotten about it. Probably it was my job to tell you about it in the first place :) |
|
I noticed is Line 312 in 95fb60a Maybe we should leave that to the optimization function instead? |
Probably a good idea! This function is old. |
|
xref #7969 -- let's see if tests pass : ) |
| return compute_as_if_collection(DataFrame, graph, name, **compute_kwargs) | ||
| else: | ||
| return Delayed(name, graph) |
There was a problem hiding this comment.
Thanks @mrocklin, overall this looks good. I'm wondering if this change is necessary. I don't think there are any Dask DataFrames involved with create_metadata_file, so I could think that the normal Delayed optimizations (i.e. culling) would be the best we could do. Am I missing something?
There was a problem hiding this comment.
Ah, that could be. I went through this file quickly
There was a problem hiding this comment.
No worries. I'm going to revert this one change as I'm pretty sure create_metadata_file won't benefit from using DataFrame optimizations (@rjzamora should feel free to correct me on that). Everything else looks good, so I'll merge this in after CI finishes
This accomplishes two things:
which improves scheduling heuristics
Edit
I first used dask.compute more liberally in
if compute:branches in order to avoid the final delayed call. Then I remembered the handycompute_as_if_collectionfunction which lets us avoid creating anything, and directly specify the collection type. This is the second commit and probably the right way forward.