@@ -1563,3 +1563,39 @@ def test_task_state_cachelocations_updated(plugin, tmp_path):
1563
1563
# both workflows should be run
1564
1564
assert all ([dir .exists () for dir in nn .output_dir ])
1565
1565
assert all ([dir .exists () for dir in nn2 .output_dir ])
1566
+
1567
+
1568
+ def test_task_files_cachelocations (plugin_dask_opt , tmp_path ):
1569
+ """
1570
+ Two identical tasks with provided cache_dir that use file as an input;
1571
+ the second task has cache_locations and should not recompute the results
1572
+ """
1573
+ cache_dir = tmp_path / "test_task_nostate"
1574
+ cache_dir .mkdir ()
1575
+ cache_dir2 = tmp_path / "test_task_nostate2"
1576
+ cache_dir2 .mkdir ()
1577
+ input_dir = tmp_path / "input"
1578
+ input_dir .mkdir ()
1579
+
1580
+ input1 = input_dir / "input1.txt"
1581
+ input1 .write_text ("test" )
1582
+ input2 = input_dir / "input2.txt"
1583
+ input2 .write_text ("test" )
1584
+
1585
+ nn = fun_file (name = "NA" , filename = input1 , cache_dir = cache_dir )
1586
+ with Submitter (plugin = plugin_dask_opt ) as sub :
1587
+ sub (nn )
1588
+
1589
+ nn2 = fun_file (
1590
+ name = "NA" , filename = input2 , cache_dir = cache_dir2 , cache_locations = cache_dir
1591
+ )
1592
+ with Submitter (plugin = plugin_dask_opt ) as sub :
1593
+ sub (nn2 )
1594
+
1595
+ # checking the results
1596
+ results2 = nn2 .result ()
1597
+ assert results2 .output .out == "test"
1598
+
1599
+ # checking if the second task didn't run the interface again
1600
+ assert nn .output_dir .exists ()
1601
+ assert not nn2 .output_dir .exists ()
0 commit comments