Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make _error_check throw exception for all errcodes #173

Merged
merged 10 commits into from
Oct 20, 2018

Conversation

dmcdougall
Copy link
Contributor

@dmcdougall dmcdougall commented Aug 21, 2018

Closes #172

Instead of swallowing the exception and turning into a warning. Fixes
issue #172.

Instead of swallowing the exception and turning into a warning.  Fixes
issue pyswmm#172.
@bemcdonnell
Copy link
Member

@dmcdougall, Thanks for the contribution! Looks like a couple tests need to be updated as well

@dmcdougall
Copy link
Contributor Author

Cool, will get to those shortly. Thanks for the feedback.

@bemcdonnell
Copy link
Member

@dmcdougall, Do you plan to update the tests? If not, no problem - I can see if someone else can support you

@michaeltryby
Copy link
Contributor

There is new api that fixes this problem in the swmm-python package.

@michaeltryby
Copy link
Contributor

pyswmm could be the first package to build off the swmm-python foundation.

@dmcdougall
Copy link
Contributor Author

I’m happy to update the tests.

Sorry for the slow response. I can do this tomorrow.

Michael’s suggestion points to a different way to handle this situation. Which direction do you folks prefer? I can update the tests to swallow an expected exception (no simulation running) which seems reasonable for a test suite. Or I can wait to build off of swmm-python.

@bemcdonnell
Copy link
Member

We are working toward moving this project away from ctypes to use the swig wrapped swmm-python but it will be quite a bit of work to flush out the swmm-python. Could be looking at many weeks/months actually. I think knowing this, updating tests would be nice; but it’s not on par with the long term objectives. In any event updating pyswmm to use swmm-python is going to be a fairly large effort. Swmm-python, today, only wraps the legacy api of swmm which is ~7 functions. The OWA swmm API has ~40 functions. When we make the next release of pyswmm using swmm-python as its low level interface to swmm, we will actually bump the release number to 1.0.0.

I think the options are

  1. Update the tests and we can make a quick release
  2. Keep everything as is and we can close this PR and this issue will take care of itself when we migrate to swmm-python.

@michaeltryby
Copy link
Contributor

Sure effort is involved but I disagree with your characterization that it’s going to be a “large” one. There is one technical hurdle remaining, how to handle structs. Then it’s smooth sailing.

@dmcdougall
Copy link
Contributor Author

What would you like me to do? Fix up the PR or close it?

If I fix up the PR, the user will see graceful failures instead of seeing warning. A consequence of this is that because of a current bug in swmm (pyswmm/Stormwater-Management-Model#193) their application won’t exit with a useful message.

If I don’t fix up the PR, the user is left with a warning instead of an exception and could be misled into believing swmm is happy with an invalid internal state.

I can see arguments on both sides.

@bemcdonnell
Copy link
Member

@dmcdougall, If you're keen to fix it (an update the tests), I'd say go for it! We will migrate the backend of this tool to use swmm-python ASAP. We can release a patch fix after you make this change

@dmcdougall
Copy link
Contributor Author

Ok, then I’ll update the tests. Thanks for the guidance.

I am loathe to remove a test, but we no longer swallow exceptions and
turn them into warnings.
This is a test, so it makes sense that we're not running a simulation.
This is a test, not a simulation, so this makes sense.
This makes sense for a test.
@dmcdougall
Copy link
Contributor Author

Hmmm, all the tests pass locally for me. I think I have to do a little more digging...

@dmcdougall
Copy link
Contributor Author

Ah, right. The error code is 309 which indicates a problem writing an output file. I suppose the filesystem footprint on AppVeyor is limited and that's perhaps why. I'll have a think about how to handle those.

@dmcdougall
Copy link
Contributor Author

I haven't forgotten about this.

I think the best thing to do with the tests is to check the error code in the except block and if it isn't code 309 then use six's reraise capability.

@bemcdonnell
Copy link
Member

@dmcdougall, i'm going to close and re-open to see if the Scrutinizer and Circle CI integrations go away... not sure what's going on with them...

@bemcdonnell bemcdonnell reopened this Oct 20, 2018
Copy link
Member

@bemcdonnell bemcdonnell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dmcdougall I made a couple changes and got the tests to pass again in CI. We will be revisiting the error management down the road. In any event- Thanks for your help!

@bemcdonnell bemcdonnell merged commit b4bec12 into pyswmm:master Oct 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

error_check swallows exceptions and converts them to warnings
3 participants