Chef client multithreading

Hi,

Chef open source server v11.1.7
chef-client v12.5.1

In quite a few of my recipes, when I run chef-client from a node and download/run the recipes, there is a need for me to download large files or perform other time consuming tasks such as unzipping large files etc.

Is there a way I can tell chef to fork off a process and keep running in the background (and keep me informed of the process’ exit status) but continue doing other things with the main chef-client process?

EDIT: I know that I can use “nohup < command > &” within a execute block; but I was wondering if there is a way to keep control within chef so that I know/get notified when the background process completes.

Regards
Aravind

There have been some experiments from myself and John Keiser, but nothing I would consider a good candidate for production usage.

You can always kick off a background task from a script resource, using curl or the like.

But keep in mind that the real problem with multithreading isn’t what you do in the background, but rather how you handle synchronization with dependencies.

Without synchronization, one of the pitfalls with using, say, a multithreaded download is that chef may report that it finished its run, but in reality the file you are downloading may take another half hour to finish. Worst case, it may overlap with the next chef run, and start the same download again, thinking that the file has been changed when in reality it is simply downloading.

All of these things are solvable, of course, but it would add a lot of complexity to your recipes.

Kevin Keane
The NetTech
http://www.4nettech.com
Our values: Privacy, Liberty, Justice
See https://www.4nettech.com/corp/the-nettech-values.html