You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
documentationImprove or add to documentationhighlevelgraphIssues relating to HighLevelGraphs.needs attentionIt's been a while since this was pushed on. Needs attention from the owner or a maintainer.
I just came across this page of the docs which hasn't been changed much since Dec 2018. I think it would be useful to update it to include a runnable example and some information about the Layer class.
Totally agree that we should update our docs on HighLevelGraphs
FWIW I think it's okay for these update to be relatively...for lack of a better term...high-level for the time being. While the concept of layers is pretty established, specific APIs around them are still developing (thoughts from others are very welcome here).
I am very much in favor of this, graphs and layers are one of the areas I am most confused about regarding Dask.
For example: I still don't get materialized layers. I get that it's about generating the full task graph for a high-level graph Layer and that it's something I should potentially watch for, but I don't really understand what that fully means, why should I care or what to do about it.
Also, I found this issue about layer categorisation useful: #7919
@GenevieveBuckley I would like to work on this. I have a fairly decent idea about the layers in general and can also provide simplistic definitions and usage.
Linking #7417 as an example of a PR implementing a new HLG Layer and long discussion about the implications (cc @ian-r-rose ). That PR, once merged, might provide interesting insights into how to design a Layer.
I wonder, though: would is not be easier to start with a layer that has no dependencies?
Are you suggesting that how-to notes should consider a simpler example, or that the tree-reduction example should start with a dependency-free case? If you are saying the latter, can you clarify what you mean by dependencies?
I probably agree. The official HLG-layer "how-to" docs should probably focus on a simple (contrived) example. I was trying to come up with a "real" example that is less-complex, but I found it difficult to think of an algorithm that cannot be mapped onto a Blockwise layer, a shuffle, a join, a map_overlap call (still MaterializedLayer for now), or a tree reduction (targeted in #8468).
from_numpy (#7417) would be a good no-deps example, and maybe the best way to finish off that PR. Also, in dask-awkward we have a few of these, where the HLG should be a lazy dict and is based on a simple comprehension, but actually get materialised every time. That example is a lot like from_numpy, but here is another one - in this case reading parquet (!).
I wrote this. It's terrible, but I did promise Ian and Gabe I would try to write something.
I think the most helpful ideas from it are:
A focus on converting existing Dask functionality (I expect more people will be doing this, compared to creating entirely new functionality with high level graphs - at least at this stage of maturity)
Explaining where the code should live, and how to find the right places
Trying to focus on how you can do the development work incrementally.
Rick's document above is much, much better, but it is extremely hard to go from zero to 200-ish lines of code in step 2. Maybe separating out what is boilerplate code that can be copied over from somewhere, vs code you must implement, vs the nice to have code you could implement (like the _dict caching) would help.
"Trying" is the operative word here this is really hard to do because there is so much boilerplate, and because you need to implement several things at once before you can test them. Then if there is a problem, there's too many places to look and possible interactions between methods and it's hard to figure out what you did wrong. (I think Gabe suggested that if there were a more robust contract, where it was clear what the inputs and outputs of methods should be then it might become easier to test them in isolation)
Circling back to the original comment on this thread:
I just came across this page of the docs which hasn't been changed much since Dec 2018. I think it would be useful to update it to include a runnable example and some information about the Layer class.
I had a look at what would need to happen to make the code example runnable. I tried to change as little as possible about the example for this experiment, although we may find another type of example that could work better.
There are a few things that jump out:
Example data generation
Small changes needed so the code does not produce errors
Differences in terminology between layer names in example text vs runnable code.
1. Example data generation
This is the first hurdle for making the example actually runnable.
The example seemed closest to the accounts example datasets created and used in the dask-tutorial. To generate those csv files, we need the files prep.py, accounts.py, and sources.py from the tutorial repo.
2. Small changes needed so the code does not produce errors
These are generally easy enough to work around.
Lines like df = df + 100 don't work for dataframes including string columns, like the names column. That can be changed to something like df = df['amount'] + 100.
3. Difference in terminology between layer names
This potentially negatively affects the clarity of the documentation. For that reason, I think this is the biggest problem out of the three.
In the current docs, "filter" is used and is very clearly understandable. In a runnable example, we get a combination of getitem, eq (and sometimes try-loc, depending on what the exact computation is). This is likely to be a lot more confusing for people, because we've moved away from having one name for the filter operation.
It's possible that number 3 would be less of a problem with a more strategically chosen example, so we should strongly consider doing that. I haven't been able to think of a really good alternative yet, ideas are welcome.
documentationImprove or add to documentationhighlevelgraphIssues relating to HighLevelGraphs.needs attentionIt's been a while since this was pushed on. Needs attention from the owner or a maintainer.
Activity
jrbourbeau commentedon May 27, 2021
Totally agree that we should update our docs on
HighLevelGraphsFWIW I think it's okay for these update to be relatively...for lack of a better term...high-level for the time being. While the concept of layers is pretty established, specific APIs around them are still developing (thoughts from others are very welcome here).
GenevieveBuckley commentedon May 27, 2021
I can help read over any drafts you make @jsignell
GenevieveBuckley commentedon May 27, 2021
@freyam might also like to follow this discussion
freyam commentedon Aug 9, 2021
@GenevieveBuckley This would be a great thing for me to work during the last week (16th to 23rd August).
jsignell commentedon Aug 12, 2021
Yes! @freyam please take this issue over!
DahnJ commentedon Oct 13, 2021
I am very much in favor of this, graphs and layers are one of the areas I am most confused about regarding Dask.
For example: I still don't get materialized layers. I get that it's about generating the full task graph for a high-level graph Layer and that it's something I should potentially watch for, but I don't really understand what that fully means, why should I care or what to do about it.
Also, I found this issue about layer categorisation useful: #7919
GenevieveBuckley commentedon Oct 14, 2021
I should add here that Freyam's google summer of code program is now over, so this issue is still available for anyone who wants to work on it.
freyam commentedon Oct 14, 2021
@GenevieveBuckley I would like to work on this. I have a fairly decent idea about the layers in general and can also provide simplistic definitions and usage.
(Always happy to contribute to Dask in any way!)
GenevieveBuckley commentedon Oct 14, 2021
You are most certainly welcome to do so 😄
martindurant commentedon Nov 30, 2021
Linking #7417 as an example of a PR implementing a new HLG Layer and long discussion about the implications (cc @ian-r-rose ). That PR, once merged, might provide interesting insights into how to design a Layer.
Also of note, in https://github.com/ContinuumIO/dask-awkward/blob/main/src/dask_awkward/core.py we use existing layer-creating functions to manufacture HLGs, but could probably create our own ( cc @douglasdavis ). This is like the prototypical "I want to make a new collection" topic that could be a great tutorial, as discussed in the dask devs meeting.
martindurant commentedon Nov 30, 2021
Also cc @rjzamora , who has developed a lot of Layers!
jakirkham commentedon Nov 30, 2021
cc @madsbk
rjzamora commentedon Dec 9, 2021
@martindurant @douglasdavis - The following gist is still very rough for now, but may be helpful for to-be layer developers: https://gist.github.com/rjzamora/3f76c6dcbde16a4185222eaadcd1d02f
martindurant commentedon Dec 9, 2021
Thanks very much, will give it a careful read. I wonder, though: would is not be easier to start with a layer that has no dependencies?
ian-r-rose commentedon Dec 9, 2021
For what it's worth, I also recently wrote up some notes on HLG pain points. It's less detailed than Rick's but perhaps still interesting
douglasdavis commentedon Dec 9, 2021
Thanks @rjzamora!
rjzamora commentedon Dec 9, 2021
Are you suggesting that how-to notes should consider a simpler example, or that the tree-reduction example should start with a dependency-free case? If you are saying the latter, can you clarify what you mean by dependencies?
martindurant commentedon Dec 9, 2021
I meant the former
rjzamora commentedon Dec 9, 2021
I probably agree. The official HLG-layer "how-to" docs should probably focus on a simple (contrived) example. I was trying to come up with a "real" example that is less-complex, but I found it difficult to think of an algorithm that cannot be mapped onto a Blockwise layer, a shuffle, a join, a map_overlap call (still MaterializedLayer for now), or a tree reduction (targeted in #8468).
martindurant commentedon Dec 9, 2021
from_numpy (#7417) would be a good no-deps example, and maybe the best way to finish off that PR. Also, in dask-awkward we have a few of these, where the HLG should be a lazy dict and is based on a simple comprehension, but actually get materialised every time. That example is a lot like from_numpy, but here is another one - in this case reading parquet (!).
GenevieveBuckley commentedon Dec 10, 2021
That is very useful @rjzamora, thank you for writing it!
I agree with the pain points you mention in the doc. Lots of parallels with discussions Ian and Gabe have had around this as well.
GenevieveBuckley commentedon Dec 10, 2021
I wrote this. It's terrible, but I did promise Ian and Gabe I would try to write something.
I think the most helpful ideas from it are:
_dictcaching) would help.GenevieveBuckley commentedon Dec 15, 2021
Circling back to the original comment on this thread:
I had a look at what would need to happen to make the code example runnable. I tried to change as little as possible about the example for this experiment, although we may find another type of example that could work better.
There are a few things that jump out:
1. Example data generation
This is the first hurdle for making the example actually runnable.
The example seemed closest to the accounts example datasets created and used in the dask-tutorial. To generate those csv files, we need the files
prep.py,accounts.py, andsources.pyfrom the tutorial repo.2. Small changes needed so the code does not produce errors
These are generally easy enough to work around.
Lines like
df = df + 100don't work for dataframes including string columns, like thenamescolumn. That can be changed to something likedf = df['amount'] + 100.3. Difference in terminology between layer names
This potentially negatively affects the clarity of the documentation. For that reason, I think this is the biggest problem out of the three.
In the current docs, "filter" is used and is very clearly understandable. In a runnable example, we get a combination of
getitem,eq(and sometimestry-loc, depending on what the exact computation is). This is likely to be a lot more confusing for people, because we've moved away from having one name for the filter operation.It's possible that number 3 would be less of a problem with a more strategically chosen example, so we should strongly consider doing that. I haven't been able to think of a really good alternative yet, ideas are welcome.
martindurant commentedon Dec 16, 2021
Ref: #7417 (review) (@gjoseph92 ) for an example of how this is all complex, or at least can be. I am more in the dark than before!