Skip to content

Commit f0c1f7f

Browse files
authored
Merge pull request #157 from pyiron/cleanUp
Move ExecutorBase to shared modules
2 parents fe3d055 + 13821c0 commit f0c1f7f

5 files changed

Lines changed: 21 additions & 21 deletions

File tree

pympipool/interfaces/fluxbroker.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
get_future_done,
99
execute_task_dict,
1010
)
11-
from pympipool.interfaces.base import ExecutorBase
11+
from pympipool.shared.base import ExecutorBase
1212
from pympipool.shared.thread import RaisingThread
1313
from pympipool.shared.taskexecutor import (
1414
cloudpickle_register,
@@ -34,23 +34,23 @@ class SingleTaskExecutor(ExecutorBase):
3434
3535
Simple example:
3636
```
37-
import numpy as np
38-
from pympipool import Executor
39-
40-
def calc(i, j, k):
41-
from mpi4py import MPI
42-
size = MPI.COMM_WORLD.Get_size()
43-
rank = MPI.COMM_WORLD.Get_rank()
44-
return np.array([i, j, k]), size, rank
45-
46-
def init_k():
47-
return {"k": 3}
48-
49-
with Executor(cores=2, init_function=init_k) as p:
50-
fs = p.submit(calc, 2, j=4)
51-
print(fs.result())
52-
53-
>>> [(array([2, 4, 3]), 2, 0), (array([2, 4, 3]), 2, 1)]
37+
>>> import numpy as np
38+
>>> from pympipool import Executor
39+
>>>
40+
>>> def calc(i, j, k):
41+
>>> from mpi4py import MPI
42+
>>> size = MPI.COMM_WORLD.Get_size()
43+
>>> rank = MPI.COMM_WORLD.Get_rank()
44+
>>> return np.array([i, j, k]), size, rank
45+
>>>
46+
>>> def init_k():
47+
>>> return {"k": 3}
48+
>>>
49+
>>> with Executor(cores=2, init_function=init_k) as p:
50+
>>> fs = p.submit(calc, 2, j=4)
51+
>>> print(fs.result())
52+
53+
[(array([2, 4, 3]), 2, 0), (array([2, 4, 3]), 2, 1)]
5454
```
5555
"""
5656

pympipool/interfaces/taskbroker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from pympipool.interfaces.base import ExecutorBase
1+
from pympipool.shared.base import ExecutorBase
22
from pympipool.shared.thread import RaisingThread
33
from pympipool.shared.broker import executor_broker
44

pympipool/interfaces/taskexecutor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from pympipool.interfaces.base import ExecutorBase
1+
from pympipool.shared.base import ExecutorBase
22
from pympipool.shared.thread import RaisingThread
33
from pympipool.shared.taskexecutor import (
44
execute_parallel_tasks,

pympipool/legacy/interfaces/executor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from pympipool.interfaces.base import ExecutorBase
1+
from pympipool.shared.base import ExecutorBase
22
from pympipool.shared.thread import RaisingThread
33
from pympipool.legacy.shared.interface import execute_serial_tasks
44
from pympipool.shared.taskexecutor import cloudpickle_register

0 commit comments

Comments
 (0)