11import typing
22from pathlib import Path
3- from typing import Any
43
54import dask .distributed
65
@@ -10,7 +9,6 @@ class DummyFuture(dask.distributed.Future):
109 A class that mimics a distributed Future, the outcome of
1110 performing submit on a distributed client.
1211 """
13-
1412 def __init__ (self , result : typing .Any ) -> None :
1513 self ._result = result # type: typing.Any
1614
@@ -35,24 +33,13 @@ class SingleThreadedClient(dask.distributed.Client):
3533 A class to Mock the Distributed Client class, in case
3634 Auto-Sklearn is meant to run in the current Thread.
3735 """
38-
3936 def __init__ (self ) -> None :
4037
4138 # Raise a not implemented error if using a method from Client
42- implemented_methods = [
43- "submit" ,
44- "close" ,
45- "shutdown" ,
46- "write_scheduler_file" ,
47- "_get_scheduler_info" ,
48- "nthreads" ,
49- ]
50- method_list = [
51- func
52- for func in dir (dask .distributed .Client )
53- if callable (getattr (dask .distributed .Client , func ))
54- and not func .startswith ("__" )
55- ]
39+ implemented_methods = ['submit' , 'close' , 'shutdown' , 'write_scheduler_file' ,
40+ '_get_scheduler_info' , 'nthreads' ]
41+ method_list = [func for func in dir (dask .distributed .Client ) if callable (
42+ getattr (dask .distributed .Client , func )) and not func .startswith ('__' )]
5643 for method in method_list :
5744 if method in implemented_methods :
5845 continue
@@ -67,24 +54,8 @@ def submit(
6754 func : typing .Callable ,
6855 * args : typing .List ,
6956 priority : int = 0 ,
70- key : Any = None ,
71- workers : Any = None ,
72- resources : Any = None ,
73- retries : Any = None ,
74- fifo_timeout : Any = "100 ms" ,
75- allow_other_workers : Any = False ,
76- actor : Any = False ,
77- actors : Any = False ,
78- pure : Any = None ,
79- ** kwargs : Any ,
57+ ** kwargs : typing .Dict ,
8058 ) -> typing .Any :
81- """
82- Note
83- ----
84- The keyword arguments caught in `dask.distributed.Client` need to
85- be specified here so they don't get passed in as ``**kwargs`` to the
86- ``func``.
87- """
8859 return DummyFuture (func (* args , ** kwargs ))
8960
9061 def close (self ) -> None :
@@ -99,17 +70,17 @@ def write_scheduler_file(self, scheduler_file: str) -> None:
9970
10071 def _get_scheduler_info (self ) -> typing .Dict :
10172 return {
102- " workers" : [" 127.0.0.1" ],
103- " type" : " Scheduler" ,
73+ ' workers' : [' 127.0.0.1' ],
74+ ' type' : ' Scheduler' ,
10475 }
10576
10677 def nthreads (self ) -> typing .Dict :
10778 return {
108- " 127.0.0.1" : 1 ,
79+ ' 127.0.0.1' : 1 ,
10980 }
11081
11182 def __repr__ (self ) -> str :
112- return " SingleThreadedClient()"
83+ return ' SingleThreadedClient()'
11384
11485 def __del__ (self ) -> None :
11586 pass
0 commit comments