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
Expose error due to failure of local python pipeline node execution #1411
Expose error due to failure of local python pipeline node execution #1411
Conversation
Thanks for making a pull request to Elyra! To try out this branch on binder, follow this link: |
Hi @kiersten-stokes - thanks for working on this. I've pulled your branch and run a pipeline with a known error. Prior to this change, the error message produced from a local run was: After the changes, it seems that most of the traceback now appears in the title. Also, note the double scrollbars in the details window - along with the While the actual error ( Have you stepped through with a debugger to see what pieces of I would also recommend adding an additional assertion in the test that ensures this (TBD) succinct portion is in the raised exception. |
@kiersten-stokes - please ignore my last comment! I just realized, when looking into debugging this, that your changes only apply to python script execution, not notebook node execution - which is what my response was about. I apologize. Why the different output must be a function of the PR branch and I wonder if there are changes in rc3 that are not in your PR. At any rate, I will switch to looking at this from the perspective of a python node. In general, when fixing issues that change what is visible to the user, I try to include the updated message or dialog for the reviewer. If you could update your opening description with a screenshot of the new message, that would be helpful - thank you. |
@kevin-bates No double scrollbars in my case.
^^ I completely agree. I tried to get something like this, but unfortunately I don't think
^^ Will do! Thank for another good tip! |
You're right - CPE is very limited (kinda frustrating actually). I think trying to log something useful and trimming the error message string to essentially the I think we have some better options with notebook node issues by trapping In your experience with CPE.stderr is it always the case that the interesting error is at the end of the stream ( |
Local notebook handling errors now look like the below, matching the general style of the log and popup box messages for python script execution errors. Note that the |
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.
This looks really good - just had a few comments.
elyra/pipeline/processor_local.py
Outdated
except papermill.PapermillExecutionError as pmee: | ||
self.log.error(f'Internal error executing {file_name}: {str(pmee.ename)}' + | ||
f'{str(pmee.evalue)} in [{str(pmee.exec_count)}]') | ||
raise RuntimeError(f'{str(pmee.ename)} {str(pmee.evalue)} in [{str(pmee.exec_count)}]') from pmee |
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 find the in [2]
portion of this confusing and regular users won't know what this means. I suggest we drop this from the RuntimeError
and even the log message.
The log will contain a traceback for this somewhere - I suspect when the web request throws - so that kind of information should be in the log.
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.
Will do! Makes sense if the normal user wouldn't get any useful info from it
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.
Perhaps if we use notebook cell X?
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.
@ptitzler - good idea, but I'd rather convey the cell index slightly differently...
f'{str(pmee.ename)} {str(pmee.evalue)} executing cell {str(pmee.cell_index}]'
which would yield...
Error processing operation load_data: FileNotFoundError [Errno 2] No such file or directory: 'data/file1.csv' executing cell 3
or
Error processing operation load_data: AssertionError executing cell 3
per examples above. Does that sound okay?
(Note: I'm assuming the attribute name is cell_index
.)
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.
Actually, amending my previous comment, cell_index
is not the correct attribute, exec_count
still gives the correct cell value.
elyra/pipeline/processor_local.py
Outdated
except Exception as ex: | ||
raise RuntimeError(f'Internal error executing {filepath}: {ex}') from ex | ||
self.log.error(f'Internal error executing {file_name}: {str(ex)}') | ||
raise RuntimeError('Internal error executing notebook') from ex |
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.
We should include the notebook name in the error.
raise RuntimeError('Internal error executing notebook') from ex | |
raise RuntimeError(f'Internal error executing {file_name}') from ex |
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.
Ah sorry, I must have misunderstood this piece in our earlier conversation. I removed the file name in the popup message because the exception message one up the chain already includes the node name, which already is the file name (sans extension).
Error processing operation load_data: Internal error executing load_data.ipynb: ...
Do you think we should keep both in?
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'm not sure it will always be the case that the node name will always be derived from the file name and I feel including the actual file name is an extra level of detail that could be useful. We might also find other "internal execution errors" that are based on other things - not necessarily related to the node/file name.
That said, everyone has opinions and mine aren't necessarily correct. 😄 I'm going to as for @ptitzler to review as well.
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 agree. Unlike in earlier releases the node name and the file name can be entirely different.
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.
Alright, that's helpful! I was wondering if there were cases where node name != file name. I'll add the file name to each of these errors, and remove the word "internal" since it's unnecessary.
elyra/pipeline/processor_local.py
Outdated
if error_trim_index != -1: | ||
raise RuntimeError(error_msg[error_trim_index:]) from cpe | ||
else: | ||
raise RuntimeError('Internal error executing Python script') from cpe |
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.
We should include the actual script name.
raise RuntimeError('Internal error executing Python script') from cpe | |
raise RuntimeError(f'Internal error executing {file_name}') from cpe |
elyra/pipeline/processor_local.py
Outdated
except Exception as ex: | ||
raise RuntimeError(f'Internal error executing {filepath}: {ex}') from ex | ||
self.log.error(f'Internal error executing {file_name}: {str(ex)}') | ||
raise RuntimeError('Internal error executing Python script') from ex |
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.
Ditto for script name.
General comment: there's probably no need to classify these as internal errors in the message text. |
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.
These changes look good. Thanks for tackling a similar issue for the notebook node as well!
Thanks, @kevin-bates! I'll just clean up those tests and hopefully we'll be all set! |
This looks awesome now - thank you @kiersten-stokes! |
Thanks @kiersten-stokes |
…1485) It introduces a new base class named ScriptOperationProcessor from which the existingPythonScriptOperationProcessor and RScriptOperationProcessor classes now derive. This base class contains 90% of the applicable code with the subclasses providing their name and argument vectors. It introduces a log_and_raise() method on the base FIleOperationProcessor class that is available to all file-based operations. Building on the work done in #1411, this method checks the length of the error message and truncates it to around the max (80), replacing overflow with ellipses (...). Adds a test that removes the kernel metadata from a notebook node and ensures the appropriate error is raised.
Resolves #1382 by adding an except block to trap
CalledProcessError
's that occur specifically as a result of python subprocess execution failure.New look
Developer's Certificate of Origin 1.1