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

Ensure that stacktrace is included in transport task exceptions #2986

Conversation

sphuber
Copy link
Contributor

@sphuber sphuber commented Jun 8, 2019

Fixes #2898 and fixes #2984

When a transport task of a calculation job excepts, the exponential
back off retry wrapper calls the logger of the process node with the
exception. This will trigger the DbLogHandler such that the log
message is entered into the database with a link to the process node.
However, only the message was included and not the stack trace which
made it difficult to determine the cause from verdi process report.
To fix this, in the Log.objects.create_from_record we attempt to
format a traceback from the exc_info if it is included in the record
which will be the case for an exception log.

This commit also fixes a bug in the ProcessLauncher._continue method
that was calling the create_future method of the communicator, which
has long been removed. Instead a normal future should just be created.

When a transport task of a calculation job excepts, the expontential
back off retry wrapper calls the logger of the process node with the
exception. This will trigger the `DbLogHandler` such that the log
message is entered into the database with a link to the process node.
However, only the message was included and not the stack trace which
made it difficult to determine the cause from `verdi process report`.
To fix this, in the `Log.objects.create_from_record` we attempt to
format a traceback from the `exc_info` if it is included in the record
which will be the case for an exception log.

This commit also fixes a bug in the `ProcessLauncher._continue` method
that was calling the `create_future` method of the communicator, which
has long been removed. Instead a normal future should just be created.
@sphuber sphuber requested a review from ltalirz June 8, 2019 21:57
@coveralls
Copy link

coveralls commented Jun 8, 2019

Coverage Status

Coverage decreased (-0.04%) to 72.953% when pulling c14fc97 on sphuber:fix_2898_add_stacktrace_calc_job_task_exceptions into 327e7d6 on aiidateam:develop.

Copy link
Member

@ltalirz ltalirz left a comment

Choose a reason for hiding this comment

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

thanks @sphuber !
just 2 minor requests

@@ -180,13 +180,15 @@ def exponential_backoff_retry(fct, initial_interval=10.0, max_attempts=5, logger
if ignore_exceptions is not None and isinstance(exception, ignore_exceptions):
raise

count = iteration + 1
core_name = coro.__name__
Copy link
Member

Choose a reason for hiding this comment

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

should this be coro_name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

absolutely, done

@@ -180,13 +180,15 @@ def exponential_backoff_retry(fct, initial_interval=10.0, max_attempts=5, logger
if ignore_exceptions is not None and isinstance(exception, ignore_exceptions):
Copy link
Member

Choose a reason for hiding this comment

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

ignore_exceptions seems to be missing a docstring. Can you add one?
It's not self-evident that "ignoring exceptions" means re-rasing them

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Member

@ltalirz ltalirz left a comment

Choose a reason for hiding this comment

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

thanks @sphuber !

@sphuber sphuber merged commit a27811e into aiidateam:develop Jun 9, 2019
@sphuber
Copy link
Contributor Author

sphuber commented Jun 9, 2019

thanks for the review @ltalirz

@sphuber sphuber deleted the fix_2898_add_stacktrace_calc_job_task_exceptions branch June 9, 2019 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants