Skip to content

Commit 47e9155

Browse files
committed
renamed cache_dir -> cache_root
1 parent 9925e9c commit 47e9155

30 files changed

+743
-734
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@
284284
"metadata": {},
285285
"outputs": [],
286286
"source": [
287-
"outputs = mrgrid(cache_dir=Path(\"~/pydra-cache\").expanduser())\n",
287+
"outputs = mrgrid(cache_root=Path(\"~/pydra-cache\").expanduser())\n",
288288
"\n",
289289
"pprint(outputs)"
290290
]
@@ -303,12 +303,12 @@
303303
"metadata": {},
304304
"outputs": [],
305305
"source": [
306-
"from pydra.utils.general import default_run_cache_dir\n",
306+
"from pydra.utils.general import default_run_cache_root\n",
307307
"\n",
308-
"my_cache_dir = Path(\"~/new-pydra-cache\").expanduser()\n",
309-
"my_cache_dir.mkdir(exist_ok=True)\n",
308+
"my_cache_root = Path(\"~/new-pydra-cache\").expanduser()\n",
309+
"my_cache_root.mkdir(exist_ok=True)\n",
310310
"\n",
311-
"outputs = mrgrid(cache_dir=my_cache_dir, cache_locations=[default_run_cache_dir])\n",
311+
"outputs = mrgrid(cache_root=my_cache_root, cache_locations=[default_run_cache_root])\n",
312312
"\n",
313313
"print(outputs)"
314314
]

docs/source/tutorial/2-advanced-execution.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
" ten_to_the_power = TenToThePower().split(p=[1, 2, 3, 4, 5])\n",
127127
"\n",
128128
" # Run the 5 tasks in parallel split across 3 processes\n",
129-
" outputs = ten_to_the_power(worker=\"cf\", n_procs=3, cache_dir=cache_root)\n",
129+
" outputs = ten_to_the_power(worker=\"cf\", n_procs=3, cache_root=cache_root)\n",
130130
"\n",
131131
" p1, p2, p3, p4, p5 = outputs.out\n",
132132
"\n",
@@ -220,7 +220,7 @@
220220
" voxel=VOX_SIZES,\n",
221221
")\n",
222222
"\n",
223-
"submitter = Submitter(cache_dir=test_dir / \"cache\")\n",
223+
"submitter = Submitter(cache_root=test_dir / \"cache\")\n",
224224
"\n",
225225
"\n",
226226
"with submitter:\n",
@@ -396,7 +396,7 @@
396396
"\n",
397397
"# Run the task to resample all NIfTI files\n",
398398
"outputs = mrgrid(\n",
399-
" hooks=TaskHooks(post_run=notify_task_completion), cache_dir=tempfile.mkdtemp()\n",
399+
" hooks=TaskHooks(post_run=notify_task_completion), cache_root=tempfile.mkdtemp()\n",
400400
")\n",
401401
"\n",
402402
"# Print the locations of the output files\n",

docs/source/tutorial/3-troubleshooting.ipynb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,13 @@
152152
"metadata": {},
153153
"outputs": [],
154154
"source": [
155-
"from pydra.utils.general import default_run_cache_dir\n",
155+
"from pydra.utils.general import default_run_cache_root\n",
156156
"import cloudpickle as cp\n",
157157
"from pprint import pprint\n",
158158
"from pydra.tasks.testing import Divide\n",
159159
"\n",
160160
"with open(\n",
161-
" default_run_cache_dir / Divide(x=15, y=0)._checksum / \"_error.pklz\", \"rb\"\n",
161+
" default_run_cache_root / Divide(x=15, y=0)._checksum / \"_error.pklz\", \"rb\"\n",
162162
") as f:\n",
163163
" error = cp.load(f)\n",
164164
"\n",
@@ -223,18 +223,18 @@
223223
"outputs": [],
224224
"source": [
225225
"import cloudpickle as cp\n",
226-
"from pydra.utils.general import user_cache_dir\n",
226+
"from pydra.utils.general import user_cache_root\n",
227227
"\n",
228-
"run_cache = user_cache_dir / \"run-cache\"\n",
228+
"run_cache = user_cache_root / \"run-cache\"\n",
229229
"\n",
230-
"for task_cache_dir in run_cache.iterdir():\n",
231-
" with open(task_cache_dir / \"_result.pklz\", \"rb\") as f:\n",
230+
"for task_cache_root in run_cache.iterdir():\n",
231+
" with open(task_cache_root / \"_result.pklz\", \"rb\") as f:\n",
232232
" result = cp.load(f)\n",
233233
" if result.outputs is not None:\n",
234234
" for field_name in result.outputs:\n",
235235
" if result.outputs[field_name] == float(\"nan\"):\n",
236236
" print(\n",
237-
" f\"Job {task_cache_dir.name!r} produced a NaN value for {field_name!r}\"\n",
237+
" f\"Job {task_cache_root.name!r} produced a NaN value for {field_name!r}\"\n",
238238
" )"
239239
]
240240
}

docs/source/tutorial/6-workflow.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@
556556
"\n",
557557
"wf = ToyMedianThreshold(in_image=nifti_file)\n",
558558
"\n",
559-
"outputs = wf(cache_dir=test_dir / \"cache\")\n",
559+
"outputs = wf(cache_root=test_dir / \"cache\")\n",
560560
"\n",
561561
"print(outputs)"
562562
]

pydra/compose/base/task.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ class Task(ty.Generic[OutputsType]):
168168
def __call__(
169169
self,
170170
/,
171-
cache_dir: os.PathLike | None = None,
171+
cache_root: os.PathLike | None = None,
172172
worker: "str | ty.Type[Worker] | Worker" = "debug",
173173
environment: "Environment | None" = None,
174174
rerun: bool = False,
@@ -183,7 +183,7 @@ def __call__(
183183
184184
Parameters
185185
----------
186-
cache_dir : os.PathLike, optional
186+
cache_root : os.PathLike, optional
187187
Cache directory where the working directory/results for the job will be
188188
stored, by default None
189189
worker : str or Worker, optional
@@ -218,7 +218,7 @@ def __call__(
218218
try:
219219
with Submitter(
220220
audit_flags=audit_flags,
221-
cache_dir=cache_dir,
221+
cache_root=cache_root,
222222
cache_locations=cache_locations,
223223
messenger_args=messenger_args,
224224
messengers=messengers,

0 commit comments

Comments
 (0)