Skip to content

Commit 9b9f51e

Browse files
authored
Define ExecutorBase in base module (#660)
* Define ExecutorBase in base module This is helpful for identifying if a software package received an executor from executorlib. ```python from executorlib import SingleNodeExecutor from executorlib import BaseExecutor exe = SingleNodeExecutor() print(isinstance(exe, ExecutorBase)) ``` * clarify that ExecutorBase is an abstract class * Rename ExecutorBase to BaseExecutor
1 parent 3c274d7 commit 9b9f51e

File tree

5 files changed

+12
-9
lines changed

5 files changed

+12
-9
lines changed

executorlib/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from executorlib.executor.base import BaseExecutor
12
from executorlib.executor.flux import (
23
FluxClusterExecutor,
34
FluxJobExecutor,
@@ -13,6 +14,7 @@
1314

1415
__all__: list[str] = [
1516
"get_cache_data",
17+
"BaseExecutor",
1618
"FluxJobExecutor",
1719
"FluxClusterExecutor",
1820
"SingleNodeExecutor",

executorlib/executor/base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import queue
2+
from abc import ABC
23
from concurrent.futures import (
34
Executor as FutureExecutor,
45
)
@@ -10,7 +11,7 @@
1011
from executorlib.task_scheduler.base import TaskSchedulerBase
1112

1213

13-
class ExecutorBase(FutureExecutor):
14+
class BaseExecutor(FutureExecutor, ABC):
1415
"""
1516
Interface class for the executor.
1617

executorlib/executor/flux.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import Callable, Optional, Union
22

3-
from executorlib.executor.base import ExecutorBase
3+
from executorlib.executor.base import BaseExecutor
44
from executorlib.standalone.inputcheck import (
55
check_command_line_argument_lst,
66
check_init_function,
@@ -17,7 +17,7 @@
1717
from executorlib.task_scheduler.interactive.onetoone import OneProcessTaskScheduler
1818

1919

20-
class FluxJobExecutor(ExecutorBase):
20+
class FluxJobExecutor(BaseExecutor):
2121
"""
2222
The executorlib.Executor leverages either the message passing interface (MPI), the SLURM workload manager or
2323
preferable the flux framework for distributing python functions within a given resource allocation. In contrast to
@@ -202,7 +202,7 @@ def __init__(
202202
)
203203

204204

205-
class FluxClusterExecutor(ExecutorBase):
205+
class FluxClusterExecutor(BaseExecutor):
206206
"""
207207
The executorlib.Executor leverages either the message passing interface (MPI), the SLURM workload manager or
208208
preferable the flux framework for distributing python functions within a given resource allocation. In contrast to

executorlib/executor/single.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import Callable, Optional, Union
22

3-
from executorlib.executor.base import ExecutorBase
3+
from executorlib.executor.base import BaseExecutor
44
from executorlib.standalone.inputcheck import (
55
check_command_line_argument_lst,
66
check_gpus_per_worker,
@@ -17,7 +17,7 @@
1717
from executorlib.task_scheduler.interactive.onetoone import OneProcessTaskScheduler
1818

1919

20-
class SingleNodeExecutor(ExecutorBase):
20+
class SingleNodeExecutor(BaseExecutor):
2121
"""
2222
The executorlib.Executor leverages either the message passing interface (MPI), the SLURM workload manager or
2323
preferable the flux framework for distributing python functions within a given resource allocation. In contrast to

executorlib/executor/slurm.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import Callable, Optional, Union
22

3-
from executorlib.executor.base import ExecutorBase
3+
from executorlib.executor.base import BaseExecutor
44
from executorlib.standalone.inputcheck import (
55
check_init_function,
66
check_plot_dependency_graph,
@@ -18,7 +18,7 @@
1818
)
1919

2020

21-
class SlurmClusterExecutor(ExecutorBase):
21+
class SlurmClusterExecutor(BaseExecutor):
2222
"""
2323
The executorlib.Executor leverages either the message passing interface (MPI), the SLURM workload manager or
2424
preferable the flux framework for distributing python functions within a given resource allocation. In contrast to
@@ -194,7 +194,7 @@ def __init__(
194194
)
195195

196196

197-
class SlurmJobExecutor(ExecutorBase):
197+
class SlurmJobExecutor(BaseExecutor):
198198
"""
199199
The executorlib.Executor leverages either the message passing interface (MPI), the SLURM workload manager or
200200
preferable the flux framework for distributing python functions within a given resource allocation. In contrast to

0 commit comments

Comments
 (0)