Designing modules with long running tasks

22 views
Skip to first unread message

Gerhardus Geldenhuis

unread,
Dec 2, 2015, 11:16:20 AM12/2/15
to Puppet Users
Hi
I am writing a module that needs to 
  • download a number of files, 
  • run an index on them 
  • and restart the service to load the index.

I first thought I could make the download and index actions a cron job that I surface via class properties but because I want to notify the service when these cron jobs are done that won't work. The alternative solution is to run download and index as execs but that could cause a puppet run to take 15min or longer depending on the network connection. I am not keen for such a long running puppet run and was wondering if anyone has solved a similar problem and could share some code. Alternatively if there is a module on forge that solves a similar problem then I would very much appreciate a pointer to it, to see how it is done. 

One possible solution would be to manually add in a service restart as part of the cron job entry that the module creates. That feels a bit clunky though. 

Best Regares

Thomas Müller

unread,
Dec 2, 2015, 11:47:06 AM12/2/15
to Puppet Users
I don't think puppet is a good fit for what you trie to do. Puppet is more about configuration and less for long running tasks.

I would recommend to write the list of files to be downloaded as a configfile for a cronjob which reads it and starts/restarts your service itself.

-Thomas

Reply all
Reply to author
Forward
0 new messages