Skip to content

Commit 50d1757

Browse files
authored
Merge pull request #62 from jakirkham/use_finally_run_bulk_job
Use `finally` in `run_bulk_job` and catch StopIteration
2 parents 4ebef42 + 47a062a commit 50d1757

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

drmaa/helpers.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,10 +288,9 @@ def run_bulk_job(jt, start, end, incr=1):
288288
while drmaa_get_next_job_id(jids.contents, jid,
289289
_BUFLEN) != NO_MORE_ELEMENTS:
290290
yield jid.value.decode()
291-
except:
292-
drmaa_release_job_ids(jids.contents)
293-
raise
294-
else:
291+
except StopIteration:
292+
pass
293+
finally:
295294
drmaa_release_job_ids(jids.contents)
296295

297296

0 commit comments

Comments
 (0)