Skip to content

Update HighLevelGraph documentation #7709

Open

Description

@jsignell

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.

Once that page is updated, it will probably make sense to update https://docs.dask.org/en/latest/phases-of-computation.html and https://docs.dask.org/en/latest/graphs.html to make it clearer how HLGs fit in.

I am happy to take on this work, but just wanted to put this here in case I am missing something.

Some resources that I am planning to draw on:
Layer Issue
Blog post about scheduling
Scheduling workshop from summit

Pinging the people who I have seen working on HLG related things: @rjzamora @GenevieveBuckley @gjoseph92 @ian-r-rose @jrbourbeau

Activity

  1. added
    documentation
    highlevelgraph
    on May 26, 2021
  2. jrbourbeau commented on May 27, 2021

    @jrbourbeau
    Member

    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).

  3. GenevieveBuckley commented on May 27, 2021

    @GenevieveBuckley
    Contributor

    I can help read over any drafts you make @jsignell

  4. GenevieveBuckley commented on May 27, 2021

    @GenevieveBuckley
    Contributor

    @freyam might also like to follow this discussion

  5. freyam commented on Aug 9, 2021

    @freyam
    Contributor

    @GenevieveBuckley This would be a great thing for me to work during the last week (16th to 23rd August).

    • Adding documentation about HLGs (dask docs)
    • A blogpost about my GSoC Project (dask blog)
    • Personal blogpost on my work (medium)
  6. jsignell commented on Aug 12, 2021

    @jsignell
    MemberAuthor

    Yes! @freyam please take this issue over!

  7. DahnJ commented on Oct 13, 2021

    @DahnJ
    Contributor

    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

  8. GenevieveBuckley commented on Oct 14, 2021

    @GenevieveBuckley
    Contributor

    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.

  9. freyam commented on Oct 14, 2021

    @freyam
    Contributor

    @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!)

  10. GenevieveBuckley commented on Oct 14, 2021

    @GenevieveBuckley
    Contributor

    You are most certainly welcome to do so 😄

  11. martindurant commented on Nov 30, 2021

    @martindurant
    Member

    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.

  12. martindurant commented on Nov 30, 2021

    @martindurant
    Member

    Also cc @rjzamora , who has developed a lot of Layers!

  13. jakirkham commented on Nov 30, 2021

    @jakirkham
    Member
  14. rjzamora commented on Dec 9, 2021

    @rjzamora
    Member
  15. martindurant commented on Dec 9, 2021

    @martindurant
    Member

    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?

  16. ian-r-rose commented on Dec 9, 2021

    @ian-r-rose
    Collaborator

    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

  17. douglasdavis commented on Dec 9, 2021

    @douglasdavis
    Member

    Thanks @rjzamora!

  18. rjzamora commented on Dec 9, 2021

    @rjzamora
    Member

    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?

  19. martindurant commented on Dec 9, 2021

    @martindurant
    Member

    I meant the former

  20. rjzamora commented on Dec 9, 2021

    @rjzamora
    Member

    I meant the former

    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).

  21. martindurant commented on Dec 9, 2021

    @martindurant
    Member

    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 (!).

  22. GenevieveBuckley commented on Dec 10, 2021

    @GenevieveBuckley
    Contributor

    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.

  23. GenevieveBuckley commented on Dec 10, 2021

    @GenevieveBuckley
    Contributor

    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:

    1. 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)
    2. Explaining where the code should live, and how to find the right places
    3. 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)
  24. GenevieveBuckley commented on Dec 15, 2021

    @GenevieveBuckley
    Contributor

    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:

    1. Example data generation
    2. Small changes needed so the code does not produce errors
    3. 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.

  25. martindurant commented on Dec 16, 2021

    @martindurant
    Member

    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!

  26. added
    needs attention
    on Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationhighlevelgraphneeds attention

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions