Skip to content

Persist-call ignores assigned worker resources #2716

Closed

Description

@Spiegel0

When .persist(resources={...}) is called on a Dask DataFrame, the specified resources will be ignored for scheduling. In particular, no task in the corresponding dashboard pages will outline the resources. In my setup, the following example triggers the issue (using python 3.6 and distributed 1.28.1):

import pandas as pd

import dask.dataframe as dd
from dask.distributed import Client


def test_resources():
    client = Client(n_workers=1, resources={"MyRes": 1000})

    test_input_frame = dd.from_pandas(pd.DataFrame({"A": [1, 2], "B": [3, 4]}), npartitions=1)
    test_output_frame = test_input_frame.apply(lambda row: row.sum(), axis=1)

    output = test_output_frame.persist(resources={"MyRes": 1})
    print(output)

    # The task pages of the dashboard do not display the resource dependencies.
    input("Press any key to exit...")
    client.close()


if __name__ == '__main__':
    test_resources()

I quickly ran the debugger on the Dask distributed code and discovered that in client.Client._graph_to_futures(...), self._expand_resources(...) returns a dict where the keys are tuples identifying the task. When I manually convert the keys to their string representation, i.e. call:

resources = {tokey(k): v for k,v in resources.items()}

after _expand_resources(...), the task dashboard will display the associated resources. (But I don't know whether converting the keys will have any other side effects)

Activity

  1. TomAugspurger commented on May 28, 2019

    @TomAugspurger
    Member

    Sorry for the lack of response here. Can you try your example (which was great btw) on distributed master? This may be fixed. Locally, I see

    Screen Shot 2019-05-28 at 6 35 29 AM

  2. jakirkham commented on May 29, 2019

    @jakirkham
    Member

    @Spiegel0, have you had a chance to restest this on master? Please let us know if there is a way to help.

  3. added a commit that references this issue on May 30, 2019
    3421866
  4. Spiegel0 commented on May 30, 2019

    @Spiegel0
    ContributorAuthor

    Thank you very much for your response! I tried the example on distributed master (commit d202e62) but the issue is still there. In my worker's page, the resources are also listed but on the task's page, they are not:
    2019-05-29-worker-screenshot
    2019-05-29-task-screenshot

    When I apply the described line, the task's page expectedly shows the following resource restriction:
    2019-05-29-task-screenshot-resource_restriction

    I'll create a brief pull-request to better describe my changes.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions