Skip to content

Commit 09285c6

Browse files
committed
fixing the tests
1 parent 20f870d commit 09285c6

File tree

1 file changed

+31
-59
lines changed

1 file changed

+31
-59
lines changed

pydra/engine/tests/test_workflow.py

Lines changed: 31 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -2072,7 +2072,7 @@ def test_wf_nostate_cachelocations(plugin, tmpdir):
20722072

20732073
# checking execution time (for unix and cf)
20742074
# for win and dask/slurm the time for dir creation etc. might take much longer
2075-
if sys.platform.startswith("win") and plugin == "cf":
2075+
if not sys.platform.startswith("win") and plugin == "cf":
20762076
assert t1 > 2
20772077
assert t2 < 0.5
20782078

@@ -2128,7 +2128,7 @@ def test_wf_nostate_cachelocations_a(plugin, tmpdir):
21282128
assert 8 == results2.output.out
21292129

21302130
# for win and dask/slurm the time for dir creation etc. might take much longer
2131-
if sys.platform.startswith("win") and plugin == "cf":
2131+
if not sys.platform.startswith("win") and plugin == "cf":
21322132
# checking execution time (second one should be quick)
21332133
assert t1 > 2
21342134
# testing relative values (windows or slurm takes much longer to create wf itself)
@@ -2189,7 +2189,7 @@ def test_wf_nostate_cachelocations_b(plugin, tmpdir):
21892189
assert 8 == results2.output.out == results2.output.out_pr
21902190

21912191
# for win and dask/slurm the time for dir creation etc. might take much longer
2192-
if sys.platform.startswith("win") and plugin == "cf":
2192+
if not sys.platform.startswith("win") and plugin == "cf":
21932193
# checking execution time
21942194
assert t1 > 2
21952195
assert t2 < 0.5
@@ -2247,7 +2247,7 @@ def test_wf_nostate_cachelocations_setoutputchange(plugin, tmpdir):
22472247
assert 8 == results2.output.out2
22482248

22492249
# for win and dask/slurm the time for dir creation etc. might take much longer
2250-
if sys.platform.startswith("win") and plugin == "cf":
2250+
if not sys.platform.startswith("win") and plugin == "cf":
22512251
# checking execution time (the second wf should be fast, nodes do not have to rerun)
22522252
assert t1 > 2
22532253
# testing relative values (windows or slurm takes much longer to create wf itself)
@@ -2303,7 +2303,7 @@ def test_wf_nostate_cachelocations_setoutputchange_a(plugin, tmpdir):
23032303
assert 8 == results2.output.out2
23042304

23052305
# for win and dask/slurm the time for dir creation etc. might take much longer
2306-
if sys.platform.startswith("win") and plugin == "cf":
2306+
if not sys.platform.startswith("win") and plugin == "cf":
23072307
# checking execution time (the second wf should be fast, nodes do not have to rerun)
23082308
assert t1 > 2
23092309
# testing relative values (windows or slurm takes much longer to create wf itself)
@@ -2361,7 +2361,7 @@ def test_wf_nostate_cachelocations_forcererun(plugin, tmpdir):
23612361
assert 8 == results2.output.out
23622362

23632363
# for win and dask/slurm the time for dir creation etc. might take much longer
2364-
if sys.platform.startswith("win") and plugin == "cf":
2364+
if not sys.platform.startswith("win") and plugin == "cf":
23652365
# checking execution time
23662366
assert t1 > 2
23672367
assert t2 > 2
@@ -2427,7 +2427,7 @@ def test_wf_nostate_cachelocations_wftaskrerun_propagateTrue(plugin, tmpdir):
24272427
assert len(list(Path(cache_dir2).glob("F*"))) == 2
24282428

24292429
# for win and dask/slurm the time for dir creation etc. might take much longer
2430-
if sys.platform.startswith("win") and plugin == "cf":
2430+
if not sys.platform.startswith("win") and plugin == "cf":
24312431
assert t1 > 2
24322432
assert t2 > 2
24332433

@@ -2486,10 +2486,10 @@ def test_wf_nostate_cachelocations_wftaskrerun_propagateFalse(plugin, tmpdir):
24862486
assert wf2.output_dir.exists()
24872487

24882488
# for win and dask/slurm the time for dir creation etc. might take much longer
2489-
if sys.platform.startswith("win") and plugin == "cf":
2489+
if not sys.platform.startswith("win") and plugin == "cf":
24902490
# checking the time
24912491
assert t1 > 2
2492-
assert t2 > 2
2492+
assert t2 < 0.5
24932493

24942494
# tasks should not be recomputed
24952495
assert len(list(Path(cache_dir1).glob("F*"))) == 2
@@ -2545,18 +2545,18 @@ def test_wf_nostate_cachelocations_taskrerun_wfrerun_propagateFalse(plugin, tmpd
25452545
results2 = wf2.result()
25462546
assert 8 == results2.output.out
25472547

2548-
# for win and dask/slurm the time for dir creation etc. might take much longer
2549-
if sys.platform.startswith("win") and plugin == "cf":
2550-
# checking the execution time
2551-
assert t1 > 2
2552-
assert t2 > 2
2553-
# checking if the second wf doesn't runs again
25542548
assert wf1.output_dir.exists()
25552549
assert wf2.output_dir.exists()
25562550
# the second task should be recomputed
25572551
assert len(list(Path(cache_dir1).glob("F*"))) == 2
25582552
assert len(list(Path(cache_dir2).glob("F*"))) == 1
25592553

2554+
# for win and dask/slurm the time for dir creation etc. might take much longer
2555+
if not sys.platform.startswith("win") and plugin == "cf":
2556+
# checking the execution time
2557+
assert t1 > 2
2558+
assert t2 > 2
2559+
25602560

25612561
def test_wf_nostate_nodecachelocations(plugin, tmpdir):
25622562
"""
@@ -2569,15 +2569,13 @@ def test_wf_nostate_nodecachelocations(plugin, tmpdir):
25692569

25702570
wf1 = Workflow(name="wf", input_spec=["x"], cache_dir=cache_dir1)
25712571
wf1.add(ten(name="ten", x=wf1.lzin.x))
2572-
wf1.add(add2_wait(name="add2", x=wf1.ten.lzout.out))
2572+
wf1.add(add2(name="add2", x=wf1.ten.lzout.out))
25732573
wf1.set_output([("out", wf1.add2.lzout.out)])
25742574
wf1.inputs.x = 3
25752575
wf1.plugin = plugin
25762576

2577-
t0 = time.time()
25782577
with Submitter(plugin=plugin) as sub:
25792578
sub(wf1)
2580-
t1 = time.time() - t0
25812579

25822580
results1 = wf1.result()
25832581
assert 12 == results1.output.out
@@ -2589,24 +2587,17 @@ def test_wf_nostate_nodecachelocations(plugin, tmpdir):
25892587
cache_locations=cache_dir1,
25902588
)
25912589
wf2.add(ten(name="ten", x=wf2.lzin.x))
2592-
wf2.add(add2_wait(name="add2", x=wf2.ten.lzout.out))
2590+
wf2.add(add2(name="add2", x=wf2.ten.lzout.out))
25932591
wf2.set_output([("out", wf2.add2.lzout.out)])
25942592
wf2.inputs.x = 2
25952593
wf2.plugin = plugin
25962594

2597-
t0 = time.time()
25982595
with Submitter(plugin=plugin) as sub:
25992596
sub(wf2)
2600-
t2 = time.time() - t0
26012597

26022598
results2 = wf2.result()
26032599
assert 12 == results2.output.out
26042600

2605-
# for win and dask/slurm the time for dir creation etc. might take much longer
2606-
if sys.platform.startswith("win") and plugin == "cf":
2607-
# checking the execution time
2608-
assert t1 > 2
2609-
assert t2 > 2
26102601
# checking if the second wf runs again, but runs only one task
26112602
assert wf1.output_dir.exists()
26122603
assert wf2.output_dir.exists()
@@ -2626,41 +2617,32 @@ def test_wf_nostate_nodecachelocations_upd(plugin, tmpdir):
26262617

26272618
wf1 = Workflow(name="wf", input_spec=["x"], cache_dir=cache_dir1)
26282619
wf1.add(ten(name="ten", x=wf1.lzin.x))
2629-
wf1.add(add2_wait(name="add2", x=wf1.ten.lzout.out))
2620+
wf1.add(add2(name="add2", x=wf1.ten.lzout.out))
26302621
wf1.set_output([("out", wf1.add2.lzout.out)])
26312622
wf1.inputs.x = 3
26322623
wf1.plugin = plugin
26332624

2634-
t0 = time.time()
26352625
with Submitter(plugin=plugin) as sub:
26362626
sub(wf1)
2637-
t1 = time.time() - t0
26382627

26392628
results1 = wf1.result()
26402629
assert 12 == results1.output.out
26412630

26422631
wf2 = Workflow(name="wf", input_spec=["x", "y"], cache_dir=cache_dir2)
26432632
wf2.add(ten(name="ten", x=wf2.lzin.x))
2644-
wf2.add(add2_wait(name="add2", x=wf2.ten.lzout.out))
2633+
wf2.add(add2(name="add2", x=wf2.ten.lzout.out))
26452634
wf2.set_output([("out", wf2.add2.lzout.out)])
26462635
wf2.inputs.x = 2
26472636
wf2.plugin = plugin
26482637
# updating cache_locations after adding the tasks
26492638
wf2.cache_locations = cache_dir1
26502639

2651-
t0 = time.time()
26522640
with Submitter(plugin=plugin) as sub:
26532641
sub(wf2)
2654-
t2 = time.time() - t0
26552642

26562643
results2 = wf2.result()
26572644
assert 12 == results2.output.out
26582645

2659-
# for win and dask/slurm the time for dir creation etc. might take much longer
2660-
if sys.platform.startswith("win") and plugin == "cf":
2661-
# checking the execution time
2662-
assert t1 > 2
2663-
assert t2 > 2
26642646
# checking if the second wf runs again, but runs only one task
26652647
assert wf1.output_dir.exists()
26662648
assert wf2.output_dir.exists()
@@ -2719,7 +2701,7 @@ def test_wf_state_cachelocations(plugin, tmpdir):
27192701
assert results2[1].output.out == 82
27202702

27212703
# for win and dask/slurm the time for dir creation etc. might take much longer
2722-
if sys.platform.startswith("win") and plugin == "cf":
2704+
if not sys.platform.startswith("win") and plugin == "cf":
27232705
# checking the execution time
27242706
assert t1 > 2
27252707
assert t2 < 0.5
@@ -2786,7 +2768,7 @@ def test_wf_state_cachelocations_forcererun(plugin, tmpdir):
27862768
assert results2[1].output.out == 82
27872769

27882770
# for win and dask/slurm the time for dir creation etc. might take much longer
2789-
if sys.platform.startswith("win") and plugin == "cf":
2771+
if not sys.platform.startswith("win") and plugin == "cf":
27902772
# checking the execution time
27912773
assert t1 > 2
27922774
assert t2 > 2
@@ -2855,7 +2837,7 @@ def test_wf_state_cachelocations_updateinp(plugin, tmpdir):
28552837
assert results2[1].output.out == 82
28562838

28572839
# for win and dask/slurm the time for dir creation etc. might take much longer
2858-
if sys.platform.startswith("win") and plugin == "cf":
2840+
if not sys.platform.startswith("win") and plugin == "cf":
28592841
# checking the execution time
28602842
assert t1 > 2
28612843
assert t2 < 0.5
@@ -2971,7 +2953,7 @@ def test_wf_nostate_cachelocations_updated(plugin, tmpdir):
29712953
assert 8 == results2.output.out
29722954

29732955
# for win and dask/slurm the time for dir creation etc. might take much longer
2974-
if sys.platform.startswith("win") and plugin == "cf":
2956+
if not sys.platform.startswith("win") and plugin == "cf":
29752957
# checking the execution time
29762958
assert t1 > 2
29772959
assert t2 > 2
@@ -2992,16 +2974,14 @@ def test_wf_nostate_cachelocations_recompute(plugin, tmpdir):
29922974

29932975
wf1 = Workflow(name="wf", input_spec=["x", "y"], cache_dir=cache_dir1)
29942976
wf1.add(multiply(name="mult", x=wf1.lzin.x, y=wf1.lzin.y))
2995-
wf1.add(add2_wait(name="add2", x=wf1.mult.lzout.out))
2977+
wf1.add(add2(name="add2", x=wf1.mult.lzout.out))
29962978
wf1.set_output([("out", wf1.add2.lzout.out)])
29972979
wf1.inputs.x = 2
29982980
wf1.inputs.y = 3
29992981
wf1.plugin = plugin
30002982

3001-
t0 = time.time()
30022983
with Submitter(plugin=plugin) as sub:
30032984
sub(wf1)
3004-
t1 = time.time() - t0
30052985

30062986
results1 = wf1.result()
30072987
assert 8 == results1.output.out
@@ -3014,16 +2994,14 @@ def test_wf_nostate_cachelocations_recompute(plugin, tmpdir):
30142994
)
30152995
# different argument assigment
30162996
wf2.add(multiply(name="mult", x=wf2.lzin.y, y=wf2.lzin.x))
3017-
wf2.add(add2_wait(name="add2", x=wf2.mult.lzout.out))
2997+
wf2.add(add2(name="add2", x=wf2.mult.lzout.out))
30182998
wf2.set_output([("out", wf2.add2.lzout.out)])
30192999
wf2.inputs.x = 2
30203000
wf2.inputs.y = 3
30213001
wf2.plugin = plugin
30223002

3023-
t0 = time.time()
30243003
with Submitter(plugin=plugin) as sub:
30253004
sub(wf2)
3026-
t2 = time.time() - t0
30273005

30283006
results2 = wf2.result()
30293007
assert 8 == results2.output.out
@@ -3032,12 +3010,6 @@ def test_wf_nostate_cachelocations_recompute(plugin, tmpdir):
30323010
assert wf1.output_dir.exists()
30333011
assert wf2.output_dir.exists()
30343012

3035-
# for win and dask/slurm the time for dir creation etc. might take much longer
3036-
if sys.platform.startswith("win") and plugin == "cf":
3037-
# checking the execution time
3038-
assert t1 > 2
3039-
assert t2 > 2
3040-
30413013
# the second wf should have only one task run
30423014
assert len(list(Path(cache_dir1).glob("F*"))) == 2
30433015
assert len(list(Path(cache_dir2).glob("F*"))) == 1
@@ -3093,7 +3065,7 @@ def test_wf_ndstate_cachelocations(plugin, tmpdir):
30933065
assert results2.output.out == [8, 82]
30943066

30953067
# for win and dask/slurm the time for dir creation etc. might take much longer
3096-
if sys.platform.startswith("win") and plugin == "cf":
3068+
if not sys.platform.startswith("win") and plugin == "cf":
30973069
# checking the execution time
30983070
assert t1 > 2
30993071
assert t2 < 0.5
@@ -3157,7 +3129,7 @@ def test_wf_ndstate_cachelocations_forcererun(plugin, tmpdir):
31573129
assert results2.output.out == [8, 82]
31583130

31593131
# for win and dask/slurm the time for dir creation etc. might take much longer
3160-
if sys.platform.startswith("win") and plugin == "cf":
3132+
if not sys.platform.startswith("win") and plugin == "cf":
31613133
# checking the execution time
31623134
assert t1 > 2
31633135
assert t2 > 2
@@ -3219,7 +3191,7 @@ def test_wf_ndstate_cachelocations_updatespl(plugin, tmpdir):
32193191
assert results2.output.out == [8, 82]
32203192

32213193
# for win and dask/slurm the time for dir creation etc. might take much longer
3222-
if sys.platform.startswith("win") and plugin == "cf":
3194+
if not sys.platform.startswith("win") and plugin == "cf":
32233195
# checking the execution time
32243196
assert t1 > 2
32253197
assert t2 < 0.5
@@ -3282,7 +3254,7 @@ def test_wf_ndstate_cachelocations_recompute(plugin, tmpdir):
32823254
assert results2.output.out == [8, 10, 62, 82]
32833255

32843256
# for win and dask/slurm the time for dir creation etc. might take much longer
3285-
if sys.platform.startswith("win") and plugin == "cf":
3257+
if not sys.platform.startswith("win") and plugin == "cf":
32863258
# checking the execution time
32873259
assert t1 > 2
32883260
assert t2 > 2
@@ -3335,7 +3307,7 @@ def test_wf_nostate_runtwice_usecache(plugin, tmpdir):
33353307
assert cache_dir_content == os.listdir(wf1.cache_dir)
33363308

33373309
# for win and dask/slurm the time for dir creation etc. might take much longer
3338-
if sys.platform.startswith("win") and plugin == "cf":
3310+
if not sys.platform.startswith("win") and plugin == "cf":
33393311
# checking the execution time
33403312
assert t1 > 2
33413313
assert t2 < 0.5
@@ -3384,7 +3356,7 @@ def test_wf_state_runtwice_usecache(plugin, tmpdir):
33843356
# checking if no new directory is created
33853357
assert cache_dir_content == os.listdir(wf1.cache_dir)
33863358
# for win and dask/slurm the time for dir creation etc. might take much longer
3387-
if sys.platform.startswith("win") and plugin == "cf":
3359+
if not sys.platform.startswith("win") and plugin == "cf":
33883360
# checking the execution time
33893361
assert t1 > 2
33903362
assert t2 < 0.5

0 commit comments

Comments
 (0)