Skip to content

Commit

Permalink
Merge pull request #21 from d-krupke/development
Browse files Browse the repository at this point in the history
FIX: Don't call setup on listfuncs
  • Loading branch information
d-krupke authored Feb 26, 2024
2 parents 987d4c8 + 9235b06 commit 6d8a02c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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``.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
]
Expand Down
5 changes: 3 additions & 2 deletions src/slurminade/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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())
Expand Down
10 changes: 9 additions & 1 deletion src/slurminade/node_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6d8a02c

Please sign in to comment.