Skip to content

Commit

Permalink
Set and test the current client
Browse files Browse the repository at this point in the history
Explicitly set the Dask resource's client as the current client using a
context manager, then test using the current client.
  • Loading branch information
kinghuang committed Sep 7, 2020
1 parent f0b40e7 commit 5a67116
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
)
import dask.dataframe as dd
from dask.dataframe.utils import assert_eq
from dask.distributed import Client

from dagster_dask import DataFrame, dask_resource

Expand All @@ -25,10 +26,11 @@
required_resource_keys={"dask"},
)
def scheduler_info_solid(context):
client = context.resources.dask.client
with context.resources.dask.client.as_current():
client = Client.current()

yield Output(client.scheduler_info(), "scheduler_info")
yield Output(client.nthreads(), "nthreads")
yield Output(client.scheduler_info(), "scheduler_info")
yield Output(client.nthreads(), "nthreads")


@pipeline(mode_defs=[ModeDefinition(resource_defs={"dask": dask_resource})])
Expand Down

0 comments on commit 5a67116

Please sign in to comment.