Skip to content

Commit 7806807

Browse files
committed
doc: clarity
- rename flag option for clarity - make docstring clearer regarding option - update documentation about option and upcoming version - adapt tests
1 parent 3970f7e commit 7806807

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

docs/snakefiles/rules.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1822,8 +1822,8 @@ Node-local files
18221822
~~~~~~~~~~~~~~~~
18231823

18241824
For performance reasons, it is sometimes useful to write intermediate files on a faster storage, e.g., attached locally on the cluster compute node rather than shared over the network.
1825-
Snakemake (since version 8.31.0) allows files to be marked with ``nodelocal``.
1826-
Files marked this way will automatically be marked as ``temp`` (unless option ``mktemp`` is *False*) and rules creating and consuming them will be automatically :ref:`grouped <job_grouping>` together so Snakemake will schedule them to the same physical node:
1825+
Snakemake (since version 9.0) allows files to be marked with ``nodelocal``.
1826+
Files marked this way will automatically be marked as ``temp`` (unless option ``flag_temp`` is *False*) and rules creating and consuming them will be automatically :ref:`grouped <job_grouping>` together so Snakemake will schedule them to the same physical node:
18271827

18281828
.. code-block:: python
18291829

src/snakemake/io.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,18 +1140,19 @@ def temp(value):
11401140
return flag(value, "temp")
11411141

11421142

1143-
def nodelocal(value, mktemp=True):
1143+
def nodelocal(value, flag_temp=True):
11441144
"""
1145-
A flag for an input or output file that only lives on the compute node executing the group jobs and not accessible from the main snakemake job.
1146-
e.g. for what some HPC call "local scratch". By default, file is also flagged as a temp
1145+
A flag for an intermediate file that only lives on the compute node executing the group jobs and not accessible from the main snakemake job.
1146+
e.g. for what some HPC call "local scratch". This will cause snakemake to automatically group rules on the same compute note.
1147+
By default, the file is also flagged as a temp (set flag_temp to False to prevent this default flagging).
11471148
"""
11481149
if is_flagged(value, "protected"):
11491150
raise SyntaxError("Node-local may not be protected.")
11501151
if is_flagged(value, "storage_object"):
11511152
raise SyntaxError("Node-local cannot be on storage.")
11521153
# NOTE technically a pipe could be nodelocal (if the FIFO is in /tmp)
11531154
# NOTE a directory can be nodelocal
1154-
if mktemp:
1155+
if flag_temp:
11551156
value = temp(value)
11561157
return flag(value, "nodelocal")
11571158

tests/test_nodelocal/Snakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ rule create_nodelocal_temp:
1515

1616
rule create_nodelocal_persist:
1717
output:
18-
nodelocal("scratch/persist.txt", mktemp=False),
18+
nodelocal("scratch/persist.txt", flag_temp=False),
1919
shell:
2020
"""
2121
sleep 4

0 commit comments

Comments
 (0)