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

Throwing RestartNeeded from onUpdateParameters() is broken at task creation time #75

Closed
rmsc opened this issue Aug 18, 2016 · 4 comments

Comments

@rmsc
Copy link
Contributor

rmsc commented Aug 18, 2016

Manager::createTask() calls Task::loadConfig(), which then calls updateParameters(). If the task's onUpdateParameters() throws a RestartNeeded, it will go all the way up to Manager::createTask().

Manager::createTask() has two exception catchers, one for std::runtime_error and a "catch-all" which just prints a simple "unknown exception" error message. RestartNeeded is NOT derived from std::runtime_error.

It is normal practice to throw a RestartNeeded whenever onUpdateParameters() fails. If it fails at task creation, the task doesn't get restarted and there's no informative error message as to why this happened. This may happen if the user forgets to set one of the mandatory task parameters, for instance, or sets a parameter to an illegal value.

A quick fix would be just make RestartNeeded derive from std::runtime_error, which at least prints a useful error message. Unfortunately, this also means that the task is not restarted, and after correctly setting the parameters the user has to restart DUNE.

A better fix would be to explicitly catch RestartNeeded exceptions when calling Task::loadConfig(), and attempt to restart the task at a later time. This may however involve some complex changes to the task creation logic.

@rmsc
Copy link
Contributor Author

rmsc commented Oct 12, 2016

Sorry for the insistence, but this report is almost a month old.

I've proposed a fix here on pull-request #81, did any of you guys have some time to take a look?

@krisklau
Copy link

I agree that a first fix would be to at least print an error message, as simply restarting the task likely wont do anything, as the same parameters are read from the same file.

On the other hand, I guess it could be argued that an invalid setting, resulting in a task not being able to start in a known state, should result in DUNE not starting at all.

An alternative would be to start the task with default parameters, but that could also result in some unexpected behaviour, from the users perspective.

I like the fix you proposed in #81.

@josebraga
Copy link
Member

@mariacosta please rule this. I'd say to decide or just open a poll to the community. Otherwise this will be here in perpetuaty.

@mariacosta
Copy link
Contributor

Merged pull request #81.

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

No branches or pull requests

4 participants