Skip to content

Commit

Permalink
CHORES: pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
d-krupke committed Feb 25, 2024
1 parent 6038bc7 commit c8a0b97
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
23 changes: 11 additions & 12 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,8 @@ A simple script could look like this:
import slurminade
slurminade.update_default_configuration(
partition="alg",
exclusive=True
) # global options for slurm
partition="alg", exclusive=True
) # global options for slurm
# If no slurm environment is found, the functions are called directly to make scripts
# compatible with any environment.
Expand Down Expand Up @@ -87,15 +86,15 @@ A simple script could look like this:
if __name__ == "__main__":
prepare.distribute()
slurminade.join() # make sure that no job runs before prepare has finished
with slurminade.JobBundling(max_size=20): # automatically bundles up to 20 tasks
# run 100x f after `prepare` has finished
for i in range(100):
f.distribute(i)
slurminade.join() # make sure that the clean up jobs runs after all f-jobs have finished
clean_up.distribute()
prepare.distribute()
slurminade.join() # make sure that no job runs before prepare has finished
with slurminade.JobBundling(max_size=20): # automatically bundles up to 20 tasks
# run 100x f after `prepare` has finished
for i in range(100):
f.distribute(i)
slurminade.join() # make sure that the clean up jobs runs after all f-jobs have finished
clean_up.distribute()
If slurm is not available, ``distribute`` results in a local function
call. Analogous for ``srun`` and ``sbatch`` (giving some extra value on
Expand Down
4 changes: 3 additions & 1 deletion examples/example_3.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ def clean_up():
if __name__ == "__main__":
jid = prepare.distribute()

with slurminade.JobBundling(max_size=20) as batch: # automatically bundles up to 20 tasks
with slurminade.JobBundling(
max_size=20
) as batch: # automatically bundles up to 20 tasks
# run 10x f after prepare has finished
for i in range(100):
f.wait_for(jid).distribute(i)
Expand Down
1 change: 1 addition & 0 deletions src/slurminade/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ def dec(func) -> SlurmFunction:

return dec


@slurmify()
def exec(cmd: typing.Union[str, typing.List[str]]):
"""
Expand Down

0 comments on commit c8a0b97

Please sign in to comment.