|
5 | 5 | import numpy as np
|
6 | 6 | import zarr
|
7 | 7 |
|
8 |
| -from cubed.runtime.executors.python import PythonDagExecutor |
9 |
| -from cubed.runtime.executors.python_async import AsyncPythonDagExecutor |
| 8 | +from cubed.runtime.create import create_executor |
10 | 9 | from cubed.runtime.types import Callback
|
11 | 10 |
|
12 | 11 | LITHOPS_LOCAL_CONFIG = {"lithops": {"backend": "localhost", "storage": "localhost"}}
|
13 | 12 |
|
14 |
| -ALL_EXECUTORS = [PythonDagExecutor()] |
| 13 | +ALL_EXECUTORS = [create_executor("single-threaded")] |
15 | 14 |
|
16 | 15 | # don't run all tests on every executor as it's too slow, so just have a subset
|
17 |
| -MAIN_EXECUTORS = [PythonDagExecutor()] |
| 16 | +MAIN_EXECUTORS = [create_executor("single-threaded")] |
18 | 17 |
|
19 | 18 |
|
20 | 19 | if platform.system() != "Windows":
|
21 | 20 | # AsyncPythonDagExecutor calls `peak_measured_mem` which is not supported on Windows
|
22 |
| - ALL_EXECUTORS.append(AsyncPythonDagExecutor()) |
| 21 | + ALL_EXECUTORS.append(create_executor("threads")) |
23 | 22 |
|
24 | 23 |
|
25 | 24 | try:
|
26 |
| - from cubed.runtime.executors.beam import BeamDagExecutor |
27 |
| - |
28 |
| - ALL_EXECUTORS.append(BeamDagExecutor()) |
29 |
| - |
30 |
| - MAIN_EXECUTORS.append(BeamDagExecutor()) |
| 25 | + ALL_EXECUTORS.append(create_executor("beam")) |
| 26 | + MAIN_EXECUTORS.append(create_executor("beam")) |
31 | 27 | except ImportError:
|
32 | 28 | pass
|
33 | 29 |
|
34 | 30 | try:
|
35 |
| - from cubed.runtime.executors.dask_distributed_async import ( |
36 |
| - AsyncDaskDistributedExecutor, |
37 |
| - ) |
38 |
| - |
39 |
| - ALL_EXECUTORS.append(AsyncDaskDistributedExecutor()) |
40 |
| - |
41 |
| - MAIN_EXECUTORS.append(AsyncDaskDistributedExecutor()) |
| 31 | + ALL_EXECUTORS.append(create_executor("dask")) |
| 32 | + MAIN_EXECUTORS.append(create_executor("dask")) |
42 | 33 | except ImportError:
|
43 | 34 | pass
|
44 | 35 |
|
45 | 36 | try:
|
46 |
| - from cubed.runtime.executors.lithops import LithopsDagExecutor |
47 |
| - |
48 |
| - ALL_EXECUTORS.append(LithopsDagExecutor(config=LITHOPS_LOCAL_CONFIG)) |
49 |
| - |
50 |
| - MAIN_EXECUTORS.append(LithopsDagExecutor(config=LITHOPS_LOCAL_CONFIG)) |
| 37 | + executor_options = dict(config=LITHOPS_LOCAL_CONFIG) |
| 38 | + ALL_EXECUTORS.append(create_executor("lithops", executor_options)) |
| 39 | + MAIN_EXECUTORS.append(create_executor("lithops", executor_options)) |
51 | 40 | except ImportError:
|
52 | 41 | pass
|
53 | 42 |
|
54 | 43 | MODAL_EXECUTORS = []
|
55 | 44 |
|
56 | 45 | try:
|
57 |
| - from cubed.runtime.executors.modal import ModalDagExecutor |
58 |
| - from cubed.runtime.executors.modal_async import AsyncModalDagExecutor |
59 |
| - |
60 |
| - MODAL_EXECUTORS.append(AsyncModalDagExecutor()) |
61 |
| - MODAL_EXECUTORS.append(ModalDagExecutor()) |
| 46 | + MODAL_EXECUTORS.append(create_executor("modal")) |
| 47 | + MODAL_EXECUTORS.append(create_executor("modal-sync")) |
62 | 48 | except ImportError:
|
63 | 49 | pass
|
64 | 50 |
|
|
0 commit comments