Skip to content

Commit

Permalink
FIX and FEATURE: Improving
Browse files Browse the repository at this point in the history
  • Loading branch information
d-krupke committed Dec 31, 2023
1 parent 8d9d260 commit ebfcc52
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ The project is reasonably easy:
Changes
-------

- 0.8.1: Bugfix and automatic detection of wrong usage when using ``Batch`` with ``wait_for``.
- 0.8.0: Added extensive logging and improved typing.
- 0.7.0: Warning if a Batch is flushed multiple times, as we noticed this to be a common indentation error.
- 0.6.2: Fixes recursive distribution guard, which seemed to be broken.
Expand Down
7 changes: 7 additions & 0 deletions src/slurminade/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ def wait_for(
sfunc = SlurmFunction(self.special_slurm_opts, self.func, self.func_id)
if isinstance(job_ids, int):
job_ids = [job_ids]
else:
job_ids = list(job_ids) # make sure it is a list
if not job_ids and not get_dispatcher().is_sequential():
msg = "Creating a dependency on an empty list of job ids."
msg += " This is probably an error in your code."
msg += " Maybe you are using `Batch` but flush outside of the `with` block?"
raise RuntimeError(msg)
if any(jid < 0 for jid in job_ids) and not get_dispatcher().is_sequential():
msg = "Invalid job id. Not every dispatcher can directly return job ids, because it may not directly distribute them or doesn't distribute them at all."
raise RuntimeError(msg)
Expand Down

0 comments on commit ebfcc52

Please sign in to comment.