New Async Observer Start/Stop scripts

06 March 2008

I've updated the Async observer start/stop scripts that I've been using extensively for pushing off long running tasks in Litmus. Combined with a few extra cap tasks this has been working perfectly for us for several weeks now.

Lots of the code is pulled out of the ferret_server and spec_server code from the Ferret and Rspec projects respectively. Download it here async_worker.zip

and get some Cap tasks from below...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
namespace :beanstalk do
  
  task :start, :roles => :app do
    run "/usr/bin/beanstalkd -d -l 127.0.0.1"
  end
  
  task :stop, :roles => :app do
    run 'killall beanstalkd'
  end
  
  task :restart, :roles => :app do
    stop
    start
  end
  
  namespace :worker do
    
    task :start, :roles => :app do
      run "cd #{deploy_to}/current && RAILS_ENV=#{rails_env} script/async_worker start"
    end
    
    task :stop, :roles => :app do
      run "cd #{deploy_to}/current && RAILS_ENV=#{rails_env} script/async_worker stop"
    end
    
    task :restart, :roles => :app do
      stop
      start
    end
    
  end
  
end

Comments

Sorry, comments are closed for this article.