brian-team / brian2

Brian is a free, open source simulator for spiking neural networks.
http://briansimulator.org
Other
905 stars 217 forks source link

Allow import of brian2 without adding exception hook #950

Open thesamovar opened 6 years ago

thesamovar commented 6 years ago

I think we currently always install an exception hook to give our more detailed error messages. It might be nice to allow for an option to not do this for advanced users making use of Brian in a more complicated context where this may be annoying. Candidate: don't install it if they import brian2.only?

mstimberg commented 6 years ago

I actually wonder whether the exception hook was a good idea in the first place. It makes every exception look like a Brian problem and it does not really seem to fulfill its main purpose, making users aware of the debug log. I don't remember ever receiving a debug log as part of a bug report without explicitly asking for it. That said, I wonder about our defaults for logging as well. Our log files can get huge (I once ran many long-running parallel simulations, and the disk space claimed by the log files became really significant) and I personally rarely look at them. I can't remember the last time they were actually helpful for fixing an issue... Maybe we should switch everything off by default (exception hook, log files)?

thesamovar commented 6 years ago

For log files I agree. For the exception hook, there is one useful thing it does which is to tell the user which object was likely to blame, and which line that object was defined on, when the problem emerges in before_run.

mstimberg commented 6 years ago

For the exception hook, there is one useful thing it does which is to tell the user which object was likely to blame, and which line that object was defined on, when the problem emerges in before_run.

Ah no, I like this feature! But this is not in the except hook, it's because we raise a BrianObjectException -- did you want to disable this feature for "power users"?

Unrelated, but I thought about it a while ago: a really nice feature that we could add via the except hook would be that Ctrl+C during a run does stop the run "gracefully".

thesamovar commented 6 years ago

Ah OK I thought we were doing that in the exception hook. So all that is doing is mentioning to look in the log files? In which case yeah it can go I think.

Ctrl-C to stop a simulation gracefully is a nice idea but how about just making it an argument to Network.run?

mstimberg commented 6 years ago

Ah OK I thought we were doing that in the exception hook. So all that is doing is mentioning to look in the log files? In which case yeah it can go I think.

Well, it prints the full "Brian2 encountered an unexpected error..." thingy, mentioning the mailing list and the bug tracker as well...

Ctrl-C to stop a simulation gracefully is a nice idea but how about just making it an argument to Network.run?

Hmm, I think it's the kind of thing that could be useful when using it interactively, when you definitely forget about adding such an option before you start the simulation ;) Anyway, I don't think this is an urgent feature to have, we should discuss this in more detail in its own issue (I'll create one).

thesamovar commented 6 years ago

Well that text could be in BrianObjectException too I guess? Mentioning the mailing list is helpful because it reduces the number of people who email us directly. Maybe remove mention of the bug tracker since almost everyone who posts there should be posting in the support list instead.