Skip to content

#780 Add custom thread names for tasks running with a timeout in ThreadUtils. - #782

Merged
yruslan merged 1 commit into
mainfrom
feature/780-add-thread-names
Jul 30, 2026
Merged

#780 Add custom thread names for tasks running with a timeout in ThreadUtils.#782
yruslan merged 1 commit into
mainfrom
feature/780-add-thread-names

Conversation

@yruslan

@yruslan yruslan commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Closes #780

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of exceptions during timed operations to prevent incorrect error reporting.
    • Enhanced reliability for tasks and email sending when timeout limits are reached.
  • Improvements

    • Added clearer identification for background task and email-processing operations, making troubleshooting and monitoring easier.
    • Preserved existing timeout behavior while improving diagnostic information.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4811940f-446c-4ea5-a9b8-767d25bcdc71

📥 Commits

Reviewing files that changed from the base of the PR and between 5debe77 and e204488.

📒 Files selected for processing (3)
  • pramen/core/src/main/scala/za/co/absa/pramen/core/notify/Sendable.scala
  • pramen/core/src/main/scala/za/co/absa/pramen/core/runner/task/TaskRunnerBase.scala
  • pramen/core/src/main/scala/za/co/absa/pramen/core/utils/ThreadUtils.scala

Walkthrough

Timeout-based email and task execution now supplies explicit worker thread names. ThreadUtils conditionally captures uncaught exceptions only from ThreadWithException instances while preserving the existing timeout parameters and naming behavior.

Changes

Thread execution observability

Layer / File(s) Summary
ThreadUtils timeout handling
pramen/core/src/main/scala/za/co/absa/pramen/core/utils/ThreadUtils.scala
runWithTimeout retains its existing parameters and defaults, while its uncaught-exception handler now updates only ThreadWithException workers.
Named timeout call sites
pramen/core/src/main/scala/za/co/absa/pramen/core/notify/Sendable.scala, pramen/core/src/main/scala/za/co/absa/pramen/core/runner/task/TaskRunnerBase.scala
Email sending uses EmailSenderThread; task execution derives a thread name from the job name and infoDate.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • AbsaOSS/pramen#773: Both changes modify ThreadUtils.runWithTimeout and related timeout call sites.

Poem

A rabbit hops where named threads run,
Email and tasks now tell everyone.
Exceptions pause for the proper thread,
Clear logs bloom where confusion fled.
Hop, hop—timeouts wear names instead!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description only says 'Closes #780' and omits the required Overview and Release Notes sections. Add the Overview and Release Notes sections from the template, plus the related issue reference.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: adding custom thread names for timeout-based tasks.
Linked Issues check ✅ Passed The code adds custom thread names to timeout-based execution paths, matching the observability goal in #780.
Out of Scope Changes check ✅ Passed The changes stay focused on timeout-thread naming and a small related refactor, with no clear out-of-scope additions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/780-add-thread-names

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

Unit Test Coverage

Overall Project 76.83% -0.04% 🍏
Files changed 57.43%

Module Coverage
pramen:core Jacoco Report 77.81% -0.04%
Files
Module File Coverage
pramen:core Jacoco Report ThreadUtils.scala 84.54% -1.37% 🍏
TaskRunnerBase.scala 82.47% -0.71%
Sendable.scala 13.33% -8.89%

@yruslan
yruslan merged commit 10fe0bf into main Jul 30, 2026
7 checks passed
@yruslan
yruslan deleted the feature/780-add-thread-names branch July 30, 2026 08:02
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

Successfully merging this pull request may close these issues.

Add thread names when tasks are executed in separate therads

1 participant