Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update plugins to inherit from WorkerPlugin #1230

Merged
merged 5 commits into from
Oct 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions dask_cuda/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import distributed # noqa: required for dask.config.get("distributed.comm.ucx")
from dask.config import canonical_name
from dask.utils import format_bytes, parse_bytes
from distributed import Worker, wait
from distributed import Worker, WorkerPlugin, wait
from distributed.comm import parse_address

try:
Expand All @@ -32,15 +32,15 @@ def nvtx_annotate(message=None, color="blue", domain=None):
yield


class CPUAffinity:
class CPUAffinity(WorkerPlugin):
def __init__(self, cores):
self.cores = cores

def setup(self, worker=None):
os.sched_setaffinity(0, self.cores)


class RMMSetup:
class RMMSetup(WorkerPlugin):
def __init__(
self,
initial_pool_size,
Expand Down Expand Up @@ -135,7 +135,7 @@ def setup(self, worker=None):
rmm.mr.set_current_device_resource(rmm.mr.TrackingResourceAdaptor(mr))


class PreImport:
class PreImport(WorkerPlugin):
def __init__(self, libraries):
if libraries is None:
libraries = []
Expand Down