https://github.com/drexed/cmdx-parallel
Parallelization execution of workflow tasks
https://github.com/drexed/cmdx-parallel
Last synced: 5 months ago
JSON representation
Parallelization execution of workflow tasks
- Host: GitHub
- URL: https://github.com/drexed/cmdx-parallel
- Owner: drexed
- License: mit
- Created: 2025-08-23T06:24:42.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2025-09-30T21:35:08.000Z (9 months ago)
- Last Synced: 2025-10-07T14:38:54.573Z (8 months ago)
- Language: Ruby
- Size: 177 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
---
Parallelization execution of workflow CMDx tasks.
[Changelog](./CHANGELOG.md) · [Report Bug](https://github.com/drexed/cmdx-parallel/issues) · [Request Feature](https://github.com/drexed/cmdx-parallel/issues)
# CMDx::Parallel
Parallelization execution of workflow tasks for [CMDx](https://github.com/drexed/cmdx).
> [!NOTE]
> The contents of this gem have been integrated in the [CMDx](https://github.com/drexed/cmdx) itself and is meant for backwards compatibility between versions `1.6.1` and `1.6.2`. This gem will only receive bug and security patches.
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'cmdx-parallel'
```
And then execute:
$ bundle
Or install it yourself as:
$ gem install cmdx-parallel
## Usage
CMDx::Parallel task execution leverages the [Parallel](https://github.com/grosser/parallel) gem, which automatically detects the number of available processors to maximize concurrent task execution.
> [!IMPORTANT]
> One important caveat to note is that context cannot be altered within parallel executions. It is best to preload the context with any required data before parallelization begins.
```ruby
class SendWelcomeNotifications < CMDx::Task
include CMDx::Workflow
# Default options (dynamically calculated to available processors)
tasks SendWelcomeEmail, SendWelcomeSms, SendWelcomePush, strategy: :parallel
end
```
### Options
Reference the [Parallel](https://github.com/grosser/parallel) gem for all processing options.
```ruby
class SendWelcomeNotifications < CMDx::Task
include CMDx::Workflow
# Fix number of threads
tasks SendWelcomeEmail, SendWelcomeSms, SendWelcomePush, strategy: :parallel, in_threads: 2
# Fix number of forked processes
tasks SendWelcomeEmail, SendWelcomeSms, SendWelcomePush, strategy: :parallel, in_processes: 2
# NOTE: Reactors are not supported
end
```
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/drexed/cmdx-parallel. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/drexed/cmdx-parallel/blob/master/CODE_OF_CONDUCT.md).
## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
## Code of Conduct
Everyone interacting in the Cmdx::Parallel project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/drexed/cmdx-parallel/blob/master/CODE_OF_CONDUCT.md).