1from . import config  # isort:skip; load distributed configuration first
2from . import widgets  # isort:skip; load distributed widgets second
3import dask
4from dask.config import config  # type: ignore
5from dask.utils import import_required
6
7from ._version import get_versions
8from .actor import Actor, ActorFuture
9from .client import (
10    Client,
11    CompatibleExecutor,
12    Executor,
13    Future,
14    as_completed,
15    default_client,
16    fire_and_forget,
17    futures_of,
18    get_task_metadata,
19    get_task_stream,
20    performance_report,
21    wait,
22)
23from .core import Status, connect, rpc
24from .deploy import Adaptive, LocalCluster, SpecCluster, SSHCluster
25from .diagnostics.plugin import (
26    Environ,
27    NannyPlugin,
28    PipInstall,
29    SchedulerPlugin,
30    UploadDirectory,
31    UploadFile,
32    WorkerPlugin,
33)
34from .diagnostics.progressbar import progress
35from .event import Event
36from .lock import Lock
37from .multi_lock import MultiLock
38from .nanny import Nanny
39from .pubsub import Pub, Sub
40from .queues import Queue
41from .scheduler import Scheduler
42from .security import Security
43from .semaphore import Semaphore
44from .threadpoolexecutor import rejoin
45from .utils import CancelledError, TimeoutError, sync
46from .variable import Variable
47from .worker import Reschedule, Worker, get_client, get_worker, print, secede, warn
48from .worker_client import local_client, worker_client
49
50versions = get_versions()
51__version__ = versions["version"]
52__git_revision__ = versions["full-revisionid"]
53del get_versions, versions
54
55if dask.config.get("distributed.admin.event-loop") in ("asyncio", "tornado"):
56    pass
57elif dask.config.get("distributed.admin.event-loop") == "uvloop":
58    import_required(
59        "uvloop",
60        "The distributed.admin.event-loop configuration value "
61        "is set to 'uvloop' but the uvloop module is not installed"
62        "\n\n"
63        "Please either change the config value or install one of the following\n"
64        "    conda install uvloop\n"
65        "    pip install uvloop",
66    )
67    import uvloop
68
69    uvloop.install()
70else:
71    raise ValueError(
72        "Expected distributed.admin.event-loop to be in ('asyncio', 'tornado', 'uvloop'), got %s"
73        % dask.config.get("distributed.admin.event-loop")
74    )
75