Provides an lwrp to execute start in parallel (via threads).
Chef 10.18 or higher
Key | Type | Description | Default |
---|---|---|---|
['thread']['pool'] | Integer | Number of thread in the pool | 10 |
thread 'something time consuming' do
block do
execute "ping -c 8.8.8.8"
end
end
thread 'something time consuming' do
block do
execute "ping -c 8.8.8.8"
end
end
thread_join "wait till finish"
This cookbook aims to provide raw parallization using standard ruby threads, without any mutex or any other data integrety support. Long running commands, like downloading tar balls, writing large files, or waiting for any ther network resource is typical use case.
Currently two resources are offered as part of this cookbooks. The reource thread is used for parallelization , it accepts a block, which can have any valid chef resources. thread resource creates a sub resource context and runs a parallel convergence in with the given block in a separate thread.
The second resource thread_join is used for joining back the thread. This is a blocking call, and it will pause the excution till the threads are finished. You must specify this resource. Else bad things can happen
- Fork the repository on Github
- Create a named feature branch (like
add_component_x
) - Write you change
- Write tests for your change (if applicable)
- Run the tests, ensuring they all pass
- Submit a Pull Request using Github
Authors: Ranjib Dey (dey.ranjib@gmail.com)