Skip to content

Use finally in run_bulk_job and catch StopIteration#62

Merged
desilinguist merged 3 commits intopygridtools:masterfrom
jakirkham:use_finally_run_bulk_job
Mar 12, 2018
Merged

Use finally in run_bulk_job and catch StopIteration#62
desilinguist merged 3 commits intopygridtools:masterfrom
jakirkham:use_finally_run_bulk_job

Conversation

@jakirkham
Copy link
Copy Markdown
Contributor

Fixes #54

Previously this code was using except and else to do the same handling. Better to just use finally in this case, which is what we do here.

Also squash a StopIteration exception that is not otherwise caught. Not totally sure how it was getting raised in the first place, but catching it avoids a DeprecationWarning and has no real other effect for the code.

cc @pitrou

While there is separate handling for `except` and `else` of a `try`
block, they don't seem to be doing anything significantly different. So
just use a `finally` statement instead and drop `except` and `else`.
As `run_bulk_job` can sometimes raise a `StopIteration` and this is
deprecated behavior, catch and squash this exception. Thus avoiding the
deprecated behavior. As this still breaks the loop and ends the
generator, this has no real effect on how this generator behaves.
@jakirkham
Copy link
Copy Markdown
Contributor Author

Failing because Travis CI switched to Ubuntu Trusty and the CI install was designed around Ubuntu Precise. PR ( #63 ) configures Travis CI to use Ubuntu Precise anyways, which fixes the issue. Will rebase after that is merged.

@jakirkham
Copy link
Copy Markdown
Contributor Author

@desilinguist, could you please take a look at these two PRs?

@desilinguist
Copy link
Copy Markdown
Contributor

Sorry for the delay. I merged #63.

@jakirkham
Copy link
Copy Markdown
Contributor Author

No worries. Thanks for taking a look.

Merged master into this PR. Expect it should pass. Any thoughts on it?

@desilinguist
Copy link
Copy Markdown
Contributor

Looks good to me 👍.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.1%) to 90.969% when pulling 47a062a on jakirkham:use_finally_run_bulk_job into 4ebef42 on pygridtools:master.

2 similar comments
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.1%) to 90.969% when pulling 47a062a on jakirkham:use_finally_run_bulk_job into 4ebef42 on pygridtools:master.

@coveralls
Copy link
Copy Markdown

coveralls commented Mar 12, 2018

Coverage Status

Coverage increased (+0.1%) to 90.969% when pulling 47a062a on jakirkham:use_finally_run_bulk_job into 4ebef42 on pygridtools:master.

@jakirkham
Copy link
Copy Markdown
Contributor Author

Thanks. Looks like it's good to go.

@desilinguist desilinguist merged commit 50d1757 into pygridtools:master Mar 12, 2018
@jakirkham jakirkham deleted the use_finally_run_bulk_job branch March 12, 2018 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants