diff --git a/README.rst b/README.rst index 5364415..936eae4 100644 --- a/README.rst +++ b/README.rst @@ -359,6 +359,7 @@ The project is reasonably easy: Changes ------- +- 0.10.1: FIX: Listing functions will no longer execute setup functions. - 0.10.0: `Batch` is now named `JobBundling`. There is a method `join` for easier synchronization. `exec` allows to executed commands just like `srun` and `sbatch`, but uniform syntax with other slurmified functions. Functions can now also be called with `distribute_and_wait`. If you call `python3 -m slurminade.check --partition YOUR_PARTITION --constraint YOUR_CONSTRAINT` you can check if your slurm configuration is running correctly. - 0.9.0: Lots of improvements. - 0.8.1: Bugfix and automatic detection of wrong usage when using ``Batch`` with ``wait_for``. diff --git a/pyproject.toml b/pyproject.toml index d887de0..ac8d859 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ where = ["src"] [project] name = "slurminade" -version = "0.10.0" +version = "0.10.1" authors = [ { name = "TU Braunschweig, IBR, Algorithms Group (Dominik Krupke)", email = "krupke@ibr.cs.tu-bs.de" }, ] diff --git a/src/slurminade/execute.py b/src/slurminade/execute.py index d58911d..6153c8b 100644 --- a/src/slurminade/execute.py +++ b/src/slurminade/execute.py @@ -12,7 +12,7 @@ from .function import SlurmFunction from .function_map import FunctionMap, set_entry_point from .guard import prevent_distribution - +from .node_setup import disable_setup @click.command() @click.option( @@ -37,7 +37,8 @@ ) def main(root, calls, fromfile, listfuncs): prevent_distribution() # make sure, the code on the node does not distribute itself. - + if listfuncs: + disable_setup() set_entry_point(root) with open(root) as f: code = "".join(f.readlines()) diff --git a/src/slurminade/node_setup.py b/src/slurminade/node_setup.py index c662926..fbe57be 100644 --- a/src/slurminade/node_setup.py +++ b/src/slurminade/node_setup.py @@ -3,12 +3,20 @@ from .guard import on_slurm_node +_no_setup = False + +def disable_setup(): + """ + Disable the setup function. This is useful for testing. + """ + global _no_setup + _no_setup = True def node_setup(func: typing.Callable): """ Decorator: Call this function on the node before running any function calls. """ - if on_slurm_node(): + if on_slurm_node() and not _no_setup: func() else: # check if the function has no arguments