Skip to content

Commit c538929

Browse files
committed
renamed cache_locations to readonly_caches
1 parent 55f0f8c commit c538929

File tree

9 files changed

+82
-82
lines changed

9 files changed

+82
-82
lines changed

docs/source/tutorial/1-getting-started.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@
294294
"metadata": {},
295295
"source": [
296296
"To check alternative cache roots, while storing any generated task cache dirs in the \n",
297-
"specified cache root, the `cache_locations` keyword argument can be used"
297+
"specified cache root, the `readonly_caches` keyword argument can be used"
298298
]
299299
},
300300
{
@@ -308,7 +308,7 @@
308308
"my_cache_root = Path(\"~/new-pydra-cache\").expanduser()\n",
309309
"my_cache_root.mkdir(exist_ok=True)\n",
310310
"\n",
311-
"outputs = mrgrid(cache_root=my_cache_root, cache_locations=[default_run_cache_root])\n",
311+
"outputs = mrgrid(cache_root=my_cache_root, readonly_caches=[default_run_cache_root])\n",
312312
"\n",
313313
"print(outputs)"
314314
]

pydra/compose/base/task.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def __call__(
172172
worker: "str | ty.Type[Worker] | Worker" = "debug",
173173
environment: "Environment | None" = None,
174174
rerun: bool = False,
175-
cache_locations: ty.Iterable[os.PathLike] | None = None,
175+
readonly_caches: ty.Iterable[os.PathLike] | None = None,
176176
audit_flags: AuditFlag = AuditFlag.NONE,
177177
messengers: ty.Iterable[Messenger] | None = None,
178178
messenger_args: dict[str, ty.Any] | None = None,
@@ -193,7 +193,7 @@ def __call__(
193193
rerun : bool, optional
194194
Whether to force the re-computation of the job results even if existing
195195
results are found, by default False
196-
cache_locations : list[os.PathLike], optional
196+
readonly_caches : list[os.PathLike], optional
197197
Alternate cache locations to check for pre-computed results, by default None
198198
audit_flags : AuditFlag, optional
199199
Auditing configuration, by default AuditFlag.NONE
@@ -219,7 +219,7 @@ def __call__(
219219
with Submitter(
220220
audit_flags=audit_flags,
221221
cache_root=cache_root,
222-
cache_locations=cache_locations,
222+
readonly_caches=readonly_caches,
223223
messenger_args=messenger_args,
224224
messengers=messengers,
225225
environment=environment,

pydra/compose/tests/test_workflow_run.py

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2152,7 +2152,7 @@ def Worky(x, y):
21522152
def test_wf_nostate_cachelocations(worker: str, tmp_path: Path):
21532153
"""
21542154
Two identical wfs with provided cache_root;
2155-
the second worky has cache_locations and should not recompute the results
2155+
the second worky has readonly_caches and should not recompute the results
21562156
"""
21572157
cache_root1 = tmp_path / "test_wf_cache3"
21582158
cache_root1.mkdir()
@@ -2187,7 +2187,7 @@ def Worky2(x, y):
21872187

21882188
t0 = time.time()
21892189
with Submitter(
2190-
worker=worker, cache_root=cache_root2, cache_locations=cache_root1
2190+
worker=worker, cache_root=cache_root2, readonly_caches=cache_root1
21912191
) as sub:
21922192
results2 = sub(worky2)
21932193

@@ -2242,7 +2242,7 @@ def Worky2(x, y):
22422242

22432243
t0 = time.time()
22442244
with Submitter(
2245-
worker=worker, cache_root=cache_root2, cache_locations=cache_root1
2245+
worker=worker, cache_root=cache_root2, readonly_caches=cache_root1
22462246
) as sub:
22472247
results2 = sub(worky2)
22482248

@@ -2295,7 +2295,7 @@ def Worky2(x, y):
22952295

22962296
t0 = time.time()
22972297
with Submitter(
2298-
worker=worker, cache_root=cache_root2, cache_locations=cache_root1
2298+
worker=worker, cache_root=cache_root2, readonly_caches=cache_root1
22992299
) as sub:
23002300
results2 = sub(worky2)
23012301

@@ -2354,7 +2354,7 @@ def Worky2(x, y):
23542354

23552355
t0 = time.time()
23562356
with Submitter(
2357-
worker=worker, cache_root=cache_root2, cache_locations=cache_root1
2357+
worker=worker, cache_root=cache_root2, readonly_caches=cache_root1
23582358
) as sub:
23592359
results2 = sub(worky2)
23602360

@@ -2411,7 +2411,7 @@ def Worky2(x, y):
24112411

24122412
t0 = time.time()
24132413
with Submitter(
2414-
worker=worker, cache_root=cache_root2, cache_locations=cache_root1
2414+
worker=worker, cache_root=cache_root2, readonly_caches=cache_root1
24152415
) as sub:
24162416
results2 = sub(worky2)
24172417

@@ -2434,7 +2434,7 @@ def Worky2(x, y):
24342434
def test_wf_nostate_cachelocations_forcererun(worker: str, tmp_path: Path):
24352435
"""
24362436
Two identical wfs with provided cache_root;
2437-
the second worky has cache_locations,
2437+
the second worky has readonly_caches,
24382438
but submitter is called with rerun=True, so should recompute
24392439
"""
24402440
cache_root1 = tmp_path / "test_wf_cache3"
@@ -2492,7 +2492,7 @@ def test_wf_nostate_cachelocations_wftaskrerun_propagateTrue(
24922492
worker: str, tmp_path: Path
24932493
):
24942494
"""
2495-
Two identical wfs with provided cache_root and cache_locations for the second one;
2495+
Two identical wfs with provided cache_root and readonly_caches for the second one;
24962496
submitter doesn't have rerun, but the second worky has rerun=True,
24972497
propagate_rerun is True as default, so everything should be rerun
24982498
"""
@@ -2528,7 +2528,7 @@ def Worky2(x, y):
25282528

25292529
t0 = time.time()
25302530
with Submitter(
2531-
worker=worker, cache_root=cache_root2, cache_locations=cache_root1
2531+
worker=worker, cache_root=cache_root2, readonly_caches=cache_root1
25322532
) as sub:
25332533
results2 = sub(worky2, rerun=True)
25342534

@@ -2555,7 +2555,7 @@ def test_wf_nostate_cachelocations_wftaskrerun_propagateFalse(
25552555
worker: str, tmp_path: Path
25562556
):
25572557
"""
2558-
Two identical wfs with provided cache_root and cache_locations for the second one;
2558+
Two identical wfs with provided cache_root and readonly_caches for the second one;
25592559
submitter doesn't have rerun, but the second worky has rerun=True,
25602560
propagate_rerun is set to False, so worky will be triggered,
25612561
but tasks will not have rerun, so will use the previous results
@@ -2594,7 +2594,7 @@ def Worky2(x, y):
25942594
with Submitter(
25952595
worker=worker,
25962596
cache_root=cache_root2,
2597-
cache_locations=cache_root1,
2597+
readonly_caches=cache_root1,
25982598
propagate_rerun=False,
25992599
) as sub:
26002600
results2 = sub(worky2, rerun=True)
@@ -2629,7 +2629,7 @@ def test_wf_nostate_cachelocations_taskrerun_wfrerun_propagateFalse(
26292629
worker: str, tmp_path: Path
26302630
):
26312631
"""
2632-
Two identical wfs with provided cache_root, and cache_locations for the second worky;
2632+
Two identical wfs with provided cache_root, and readonly_caches for the second worky;
26332633
submitter doesn't have rerun, but worky has rerun=True,
26342634
since propagate_rerun=False, only tasks that have rerun=True will be rerun
26352635
"""
@@ -2668,7 +2668,7 @@ def Worky2(x, y):
26682668
with Submitter(
26692669
worker=worker,
26702670
cache_root=cache_root2,
2671-
cache_locations=cache_root1,
2671+
readonly_caches=cache_root1,
26722672
propagate_rerun=False,
26732673
) as sub:
26742674
results2 = sub(worky2, rerun=True) # rerun will not be propagated to each task)
@@ -2692,7 +2692,7 @@ def Worky2(x, y):
26922692
def test_wf_nostate_nodecachelocations(worker: str, tmp_path: Path):
26932693
"""
26942694
Two wfs with different input, but the second node has the same input;
2695-
the second worky has cache_locations and should recompute the worky,
2695+
the second worky has readonly_caches and should recompute the worky,
26962696
but without recomputing the second node
26972697
"""
26982698
cache_root1 = tmp_path / "test_wf_cache3"
@@ -2725,7 +2725,7 @@ def Worky2(x, y=None):
27252725
worky2 = Worky2(x=2)
27262726

27272727
with Submitter(
2728-
worker=worker, cache_root=cache_root2, cache_locations=cache_root1
2728+
worker=worker, cache_root=cache_root2, readonly_caches=cache_root1
27292729
) as sub:
27302730
results2 = sub(worky2)
27312731

@@ -2744,7 +2744,7 @@ def Worky2(x, y=None):
27442744
def test_wf_nostate_nodecachelocations_upd(worker: str, tmp_path: Path):
27452745
"""
27462746
Two wfs with different input, but the second node has the same input;
2747-
the second worky has cache_locations (set after adding tasks) and should recompute,
2747+
the second worky has readonly_caches (set after adding tasks) and should recompute,
27482748
but without recomputing the second node
27492749
"""
27502750
cache_root1 = tmp_path / "test_wf_cache3"
@@ -2776,7 +2776,7 @@ def Worky2(x, y=None):
27762776
worky2 = Worky2(x=2)
27772777

27782778
with Submitter(
2779-
worker=worker, cache_root=cache_root2, cache_locations=cache_root1
2779+
worker=worker, cache_root=cache_root2, readonly_caches=cache_root1
27802780
) as sub:
27812781
results2 = sub(worky2)
27822782

@@ -2795,7 +2795,7 @@ def Worky2(x, y=None):
27952795
def test_wf_state_cachelocations(worker: str, tmp_path: Path):
27962796
"""
27972797
Two identical wfs (with states) with provided cache_root;
2798-
the second worky has cache_locations and should not recompute the results
2798+
the second worky has readonly_caches and should not recompute the results
27992799
"""
28002800
cache_root1 = tmp_path / "test_wf_cache3"
28012801
cache_root1.mkdir()
@@ -2831,7 +2831,7 @@ def Worky2(x, y):
28312831

28322832
t0 = time.time()
28332833
with Submitter(
2834-
worker=worker, cache_root=cache_root2, cache_locations=cache_root1
2834+
worker=worker, cache_root=cache_root2, readonly_caches=cache_root1
28352835
) as sub:
28362836
results2 = sub(worky2)
28372837

@@ -2858,7 +2858,7 @@ def Worky2(x, y):
28582858
def test_wf_state_cachelocations_forcererun(worker: str, tmp_path: Path):
28592859
"""
28602860
Two identical wfs (with states) with provided cache_root;
2861-
the second worky has cache_locations,
2861+
the second worky has readonly_caches,
28622862
but submitter is called with rerun=True, so should recompute
28632863
"""
28642864
cache_root1 = tmp_path / "test_wf_cache3"
@@ -2919,7 +2919,7 @@ def Worky2(x, y):
29192919
def test_wf_state_cachelocations_updateinp(worker: str, tmp_path: Path):
29202920
"""
29212921
Two identical wfs (with states) with provided cache_root;
2922-
the second worky has cache_locations and should not recompute the results
2922+
the second worky has readonly_caches and should not recompute the results
29232923
(the lazy input of the node is updated to the correct one,
29242924
i.e. the same as in worky1, after adding the node to the worky)
29252925
"""
@@ -2956,7 +2956,7 @@ def Worky2(x, y):
29562956

29572957
t0 = time.time()
29582958
with Submitter(
2959-
worker=worker, cache_root=cache_root2, cache_locations=cache_root1
2959+
worker=worker, cache_root=cache_root2, readonly_caches=cache_root1
29602960
) as sub:
29612961
results2 = sub(worky2)
29622962

@@ -2982,7 +2982,7 @@ def Worky2(x, y):
29822982
def test_wf_state_n_nostate_cachelocations(worker: str, tmp_path: Path):
29832983
"""
29842984
Two wfs with provided cache_root, the first one has no state, the second has;
2985-
the second worky has cache_locations and should not recompute only one element
2985+
the second worky has readonly_caches and should not recompute only one element
29862986
"""
29872987
cache_root1 = tmp_path / "test_wf_cache3"
29882988
cache_root1.mkdir()
@@ -3014,7 +3014,7 @@ def Worky2(x, y):
30143014
worky2 = Worky2().split(("x", "y"), x=[2, 20], y=[3, 4])
30153015

30163016
with Submitter(
3017-
worker=worker, cache_root=cache_root2, cache_locations=cache_root1
3017+
worker=worker, cache_root=cache_root2, readonly_caches=cache_root1
30183018
) as sub:
30193019
results2 = sub(worky2)
30203020

@@ -3027,9 +3027,9 @@ def Worky2(x, y):
30273027
def test_wf_nostate_cachelocations_updated(worker: str, tmp_path: Path):
30283028
"""
30293029
Two identical wfs with provided cache_root;
3030-
the second worky has cache_locations in init,
3030+
the second worky has readonly_caches in init,
30313031
that is later overwritten in Submitter.__call__;
3032-
the cache_locations from call doesn't exist so the second task should run again
3032+
the readonly_caches from call doesn't exist so the second task should run again
30333033
"""
30343034
cache_root1 = tmp_path / "test_wf_cache3"
30353035
cache_root1.mkdir()
@@ -3065,9 +3065,9 @@ def Worky2(x, y):
30653065
worky2 = Worky2(x=2, y=3)
30663066

30673067
t0 = time.time()
3068-
# changing cache_locations to non-existing dir
3068+
# changing readonly_caches to non-existing dir
30693069
with Submitter(
3070-
worker=worker, cache_root=cache_root2, cache_locations=cache_root1_empty
3070+
worker=worker, cache_root=cache_root2, readonly_caches=cache_root1_empty
30713071
) as sub:
30723072
results2 = sub(worky2)
30733073

@@ -3124,7 +3124,7 @@ def Worky2(x, y):
31243124
worky2 = Worky2(x=2, y=3)
31253125

31263126
with Submitter(
3127-
worker=worker, cache_root=cache_root2, cache_locations=cache_root1
3127+
worker=worker, cache_root=cache_root2, readonly_caches=cache_root1
31283128
) as sub:
31293129
results2 = sub(worky2)
31303130

@@ -3144,7 +3144,7 @@ def Worky2(x, y):
31443144
def test_wf_ndstate_cachelocations(worker: str, tmp_path: Path):
31453145
"""
31463146
Two wfs with identical inputs and node states;
3147-
the second worky has cache_locations and should not recompute the results
3147+
the second worky has readonly_caches and should not recompute the results
31483148
"""
31493149
cache_root1 = tmp_path / "test_wf_cache3"
31503150
cache_root1.mkdir()
@@ -3179,7 +3179,7 @@ def Worky2(x, y):
31793179

31803180
t0 = time.time()
31813181
with Submitter(
3182-
worker=worker, cache_root=cache_root2, cache_locations=cache_root1
3182+
worker=worker, cache_root=cache_root2, readonly_caches=cache_root1
31833183
) as sub:
31843184
results2 = sub(worky2)
31853185

@@ -3199,7 +3199,7 @@ def Worky2(x, y):
31993199
def test_wf_ndstate_cachelocations_forcererun(worker: str, tmp_path: Path):
32003200
"""
32013201
Two wfs with identical inputs and node states;
3202-
the second worky has cache_locations,
3202+
the second worky has readonly_caches,
32033203
but submitter is called with rerun=True, so should recompute
32043204
"""
32053205
cache_root1 = tmp_path / "test_wf_cache3"
@@ -3257,7 +3257,7 @@ def Worky2(x, y):
32573257
def test_wf_ndstate_cachelocations_updatespl(worker: str, tmp_path: Path):
32583258
"""
32593259
Two wfs with identical inputs and node state (that is set after adding the node!);
3260-
the second worky has cache_locations and should not recompute the results
3260+
the second worky has readonly_caches and should not recompute the results
32613261
"""
32623262
cache_root1 = tmp_path / "test_wf_cache3"
32633263
cache_root1.mkdir()
@@ -3292,7 +3292,7 @@ def Worky2(x, y):
32923292

32933293
t0 = time.time()
32943294
with Submitter(
3295-
worker=worker, cache_root=cache_root2, cache_locations=cache_root1
3295+
worker=worker, cache_root=cache_root2, readonly_caches=cache_root1
32963296
) as sub:
32973297
results2 = sub(worky2)
32983298

@@ -3317,7 +3317,7 @@ def Worky2(x, y):
33173317
def test_wf_ndstate_cachelocations_recompute(worker: str, tmp_path: Path):
33183318
"""
33193319
Two wfs (with nodes with states) with provided cache_root;
3320-
the second worky has cache_locations and should not recompute the results
3320+
the second worky has readonly_caches and should not recompute the results
33213321
"""
33223322
cache_root1 = tmp_path / "test_wf_cache3"
33233323
cache_root1.mkdir()
@@ -3352,7 +3352,7 @@ def Worky2(x, y):
33523352

33533353
t0 = time.time()
33543354
with Submitter(
3355-
worker=worker, cache_root=cache_root2, cache_locations=cache_root1
3355+
worker=worker, cache_root=cache_root2, readonly_caches=cache_root1
33563356
) as sub:
33573357
results2 = sub(worky2)
33583358

0 commit comments

Comments
 (0)