Skip to content

Graph optimization loses annotations #7036

@ian-r-rose

Description

@ian-r-rose

Came across this when working on dask/distributed#4347 . The new annotations machinery is attached to high level graph Layers. However, in the optimization step, layers can be rewritten, and new layers can lose their annotations. This can especially cause unintended effects when these annotation affect scheduling/execution (as is the case when specifying workers, priority, retries, etc).

A MWE that reproduces the issue on dask master:

import dask
import dask.array as da

with dask.annotate(foo="bar"):
    a = da.ones((1,1))
    
print(a.__dask_graph__().layers[a.name].annotations)
aa, = dask.optimize(a)
print(aa.__dask_graph__().layers[aa.name].annotations)

produces

{'foo': 'bar'}
None

Perhaps @sjperkins or @rjzamora may have some insight into the best fix here (it looks like @sjperkins may have come across this before?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    highlevelgraphIssues relating to HighLevelGraphs.needs attentionIt's been a while since this was pushed on. Needs attention from the owner or a maintainer.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions