Skip to content

Commit

Permalink
avoid creating Lock/Event without a running loop
Browse files Browse the repository at this point in the history
  • Loading branch information
graingert committed Jul 27, 2022
1 parent 4ac1404 commit 3c26731
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion dask_jobqueue/core.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from contextlib import contextmanager, suppress
import asyncio
import logging
import math
import os
Expand All @@ -11,6 +12,7 @@
import tempfile
import copy
import warnings
import functools

import dask

Expand Down Expand Up @@ -94,7 +96,22 @@
""".strip()


class Job(ProcessInterface, abc.ABC):
class FixedProcessInterface(ProcessInterface):
def __init__(self, scheduler=None, name=None):
self.address = getattr(self, "address", None)
self.external_address = None
self.status = Status.created

@functools.cached_property
def lock(self):
return asyncio.Lock()

@functools.cached_property
def _event_finished(self):
return asyncio.Event()


class Job(FixedProcessInterface, abc.ABC):
""" Base class to launch Dask workers on Job queues
This class should not be used directly, use a class appropriate for
Expand Down

0 comments on commit 3c26731

Please sign in to comment.