-
Notifications
You must be signed in to change notification settings - Fork 117
[feat] Print error information when a modules system operation fails #628
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
[feat] Print error information when a modules system operation fails #628
Conversation
vkarak
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should add another layer between the _exec_load_command() and the actual implementation of the backends. The backends should then throw a SpawnedProcessError, which will contain all the information of the failing command, i.e., command arguments, stdout, stderr, exit code. We should do sth like the following:
def exec_module_command(self, *args, msg=None):
try:
self._exec_module_command(self, *args)
except SpawnedProcessError as e:
raise EnvironError(msg) from eThe advantage of this is that when we print the top-level exception, the information of the exceptions that caused the problem are also printed. And in a uniform way (you don't have to deal with where to put the :).
|
Following our discussion offline, the correct interface should be sth like the following: def _run_module_command(self, *args, msg=None):
command = [self._command, *args]
try:
completed = os_ext.run_command(' '.join(command), check=True)
except SpawnedProcessError as e:
raise EnvironError(msg) from e
# Check for ERROR inside the stderr as of now in _exec_module_command()
if error:
raise EnvironError(msg) from SpawnedProcessError(completed.command, completed.stdout, ...)
return completed
def _exec_module_command(self, *args, msg=None):
completed = self._run_module_command(*args, msg)
exec(completed.stdout) |
vkarak
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My comments are mostly related to coding style issues.
|
@jenkins-cscs retry dom kesch |
|
@jenkins-cscs retry dom kesch daint |
Closes #467