-
-
Notifications
You must be signed in to change notification settings - Fork 6
feat(iswf): Adds silenced_exceptions parameter to tasks, exposes this and report_timeout_errors in task registration #608
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
Changes from all commits
498c91f
f37ed8f
7f580b4
3e53af7
a2800de
24f66a6
4908092
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -266,6 +266,7 @@ def handle_alarm(signum: int, frame: FrameType | None) -> None: | |
| except Exception as err: | ||
| retry = task_func.retry | ||
| captured_error = False | ||
| should_capture_error = not isinstance(err, task_func.silenced_exceptions) | ||
| if retry: | ||
| if retry.should_retry(inflight.activation.retry_state, err): | ||
| logger.info( | ||
|
Comment on lines
266
to
272
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: The Suggested FixModify the Prompt for AI Agent
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is intentional. |
||
|
|
@@ -280,20 +281,27 @@ def handle_alarm(signum: int, frame: FrameType | None) -> None: | |
| next_state = TASK_ACTIVATION_STATUS_RETRY | ||
| elif retry.max_attempts_reached(inflight.activation.retry_state): | ||
| with sentry_sdk.isolation_scope() as scope: | ||
| retry_error = NoRetriesRemainingError( | ||
| f"{inflight.activation.taskname} has consumed all of its retries" | ||
| ) | ||
| retry_error.__cause__ = err | ||
| scope.fingerprint = [ | ||
| "taskworker.no_retries_remaining", | ||
| inflight.activation.namespace, | ||
| inflight.activation.taskname, | ||
| ] | ||
| scope.set_transaction_name(inflight.activation.taskname) | ||
| sentry_sdk.capture_exception(retry_error) | ||
| if should_capture_error: | ||
| retry_error = NoRetriesRemainingError( | ||
| f"{inflight.activation.taskname} has consumed all of its retries" | ||
| ) | ||
| retry_error.__cause__ = err | ||
| scope.fingerprint = [ | ||
| "taskworker.no_retries_remaining", | ||
| inflight.activation.namespace, | ||
| inflight.activation.taskname, | ||
| ] | ||
| scope.set_transaction_name(inflight.activation.taskname) | ||
| sentry_sdk.capture_exception(retry_error) | ||
| # In this branch, all exceptions should be either | ||
| # captured or silenced. | ||
|
cursor[bot] marked this conversation as resolved.
|
||
| captured_error = True | ||
|
|
||
| if not captured_error and next_state != TASK_ACTIVATION_STATUS_RETRY: | ||
| if ( | ||
| should_capture_error | ||
| and not captured_error | ||
| and next_state != TASK_ACTIVATION_STATUS_RETRY | ||
| ): | ||
| sentry_sdk.capture_exception(err) | ||
|
|
||
| clear_current_task() | ||
|
|
||
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.
Bug: The new
expected_exceptionsandreport_timeout_errorsparameters onExternalNamespace.register()have no effect becauseExternalTaskinstances are not executed locally.Severity: MEDIUM
Suggested Fix
Raise a
TypeErrororValueErrorifexpected_exceptionsorreport_timeout_errorsare passed toExternalNamespace.register(), as these parameters are not supported for external tasks. Alternatively, document this limitation clearly in the method's docstring to prevent misuse.Prompt for AI Agent
Did we get this right? 👍 / 👎 to inform future reviews.