improvement: Executor package now includes RunnableExecutor and SupplierExecutor which provide higher-level abstractions for parallel task execution #20

Merged
k-simons merged 3 commits from ksimons/addEx into develop 2026-01-26 18:32:45 +00:00
k-simons commented 2026-01-26 16:10:15 +00:00 (Migrated from github.com)

Before

The executor package only contained ItemSubmitter for queue-based item processing. Users who wanted to execute multiple runnables or suppliers in parallel and wait for all results had to manually manage worker pools, futures, and error collection.

After

The executor package now includes RunnableExecutor and SupplierExecutor which provide higher-level abstractions for parallel task execution:

  • RunnableExecutor: Execute multiple function.Runnable tasks in parallel and collect all errors
  • SupplierExecutor[T]: Execute multiple function.Supplier[T] tasks in parallel with two strategies:
    • ResolveAll: Returns all successful results and all errors
    • ResolveUntilError: Returns results only if all succeed, otherwise returns the first error

Key Changes

  • Add RunnableExecutor interface with ExecuteRunnables and ExecuteRunnable methods
  • Add SupplierExecutor[T] generic interface with ResolveAll and ResolveUntilError methods
  • Add NewDefaultRunnableExecutor constructor that wraps a workerpool.RunnableWorkerPool
  • Add NewDefaultSupplierExecutor[T] constructor that wraps a workerpool.SupplierWorkerPool[T]
  • Add comprehensive tests for both executors covering success and error scenarios

Testing

  • All new code has unit tests
  • Tests cover: successful execution, error propagation, partial failures, and multiple task execution
  • All tests pass: go test ./executor/...

Downsides

None identified. These are additive changes that don't modify existing functionality.

Documentation

Interfaces are documented with godoc comments explaining their behavior.

Before The executor package only contained ItemSubmitter for queue-based item processing. Users who wanted to execute multiple runnables or suppliers in parallel and wait for all results had to manually manage worker pools, futures, and error collection. After The executor package now includes RunnableExecutor and SupplierExecutor which provide higher-level abstractions for parallel task execution: - RunnableExecutor: Execute multiple function.Runnable tasks in parallel and collect all errors - SupplierExecutor[T]: Execute multiple function.Supplier[T] tasks in parallel with two strategies: - ResolveAll: Returns all successful results and all errors - ResolveUntilError: Returns results only if all succeed, otherwise returns the first error Key Changes - Add RunnableExecutor interface with ExecuteRunnables and ExecuteRunnable methods - Add SupplierExecutor[T] generic interface with ResolveAll and ResolveUntilError methods - Add NewDefaultRunnableExecutor constructor that wraps a workerpool.RunnableWorkerPool - Add NewDefaultSupplierExecutor[T] constructor that wraps a workerpool.SupplierWorkerPool[T] - Add comprehensive tests for both executors covering success and error scenarios Testing - All new code has unit tests - Tests cover: successful execution, error propagation, partial failures, and multiple task execution - All tests pass: go test ./executor/... Downsides None identified. These are additive changes that don't modify existing functionality. Documentation Interfaces are documented with godoc comments explaining their behavior.
changelog-app[bot] commented 2026-01-26 16:10:20 +00:00 (Migrated from github.com)

Generate changelog in changelog/@unreleased

Type (Select exactly one)

  • Feature (Adding new functionality)
  • Improvement (Improving existing functionality)
  • Fix (Fixing an issue with existing functionality)
  • Break (Creating a new major version by breaking public APIs)
  • Deprecation (Removing functionality in a non-breaking way)
  • Migration (Automatically moving data/functionality to a new system)

Description Executor package now includes RunnableExecutor and SupplierExecutor which provide higher-level abstractions for parallel task execution

Check the box to generate changelog(s)

  • Generate changelog entry
### Generate changelog in <changelog-dir>`changelog/@unreleased`</changelog-dir> **Type** _(Select exactly one)_ <changelog-type> - [ ] **Feature** (Adding new functionality) - [x] **Improvement** (Improving existing functionality) - [ ] **Fix** (Fixing an issue with existing functionality) - [ ] **Break** (Creating a _new major version_ by breaking public APIs) - [ ] **Deprecation** (Removing functionality in a non-breaking way) - [ ] **Migration** (Automatically moving data/functionality to a new system) </changelog-type> **Description** <changelog-description> Executor package now includes RunnableExecutor and SupplierExecutor which provide higher-level abstractions for parallel task execution </changelog-description><changelog-links></changelog-links> **Check the box to generate changelog(s)** - [x] Generate changelog entry
changelog-app[bot] commented 2026-01-26 16:10:54 +00:00 (Migrated from github.com)

✅ Successfully generated changelog entry!

Need to regenerate?

Simply interact with the changelog bot comment again to regenerate these entries.


📋Changelog Preview

💡 Improvements

  • Executor package now includes RunnableExecutor and SupplierExecutor which provide higher-level abstractions for parallel task execution (#20)
### ✅ **Successfully generated changelog entry!** #### Need to regenerate? Simply interact with the changelog bot comment again to regenerate these entries. --- ### 📋Changelog Preview ### 💡 Improvements * Executor package now includes RunnableExecutor and SupplierExecutor which provide higher-level abstractions for parallel task execution ([#20](https://github.com/palantir/witchcraft-go-tasks/pull/20)) <!-- changelog-success-comment -->
tabboud (Migrated from github.com) approved these changes 2026-01-26 18:32:39 +00:00
autorelease3[bot] commented 2026-01-26 18:32:54 +00:00 (Migrated from github.com)

Released v0.8.0

Released [v0.8.0](https://github.com/palantir/witchcraft-go-tasks/releases/tag/v0.8.0)
Sign in to join this conversation.
No description provided.