-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename test / add no_exit test for execute
- Loading branch information
Showing
2 changed files
with
43 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from time import time, sleep | ||
|
||
from distributed import Client | ||
from mpi4py.MPI import COMM_WORLD as world | ||
|
||
from dask_mpi import execute | ||
|
||
# Split our MPI world into two pieces, one consisting just of | ||
# the old rank 3 process and the other with everything else | ||
new_comm_assignment = 1 if world.rank == 3 else 0 | ||
comm = world.Split(new_comm_assignment) | ||
|
||
if world.rank != 3: | ||
def client_code(): | ||
with Client() as c: | ||
start = time() | ||
while len(c.scheduler_info()["workers"]) != 1: | ||
assert time() < start + 10 | ||
sleep(0.2) | ||
|
||
c.submit(lambda x: x + 1, 10).result() == 11 | ||
c.submit(lambda x: x + 1, 20).result() == 21 | ||
|
||
execute(client_code, comm=comm) | ||
|
||
# check that our original comm is intact | ||
world.Barrier() | ||
x = 100 if world.rank == 0 else 200 | ||
x = world.bcast(x) | ||
assert x == 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters