Permalink
Browse files

Run multiple job workers simultaneously

  • Loading branch information...
swaroopch committed Jul 31, 2011
1 parent 93aac01 commit 7915ed1777e6c9d45444b50dfcecaa608fbda22f
Showing with 10 additions and 4 deletions.
  1. +9 −3 fabfile.py
  2. +1 −1 upstart/isbn.net.in-job-1.conf
View
@@ -31,9 +31,15 @@ def push():
_transfer_files(local_dir, env.host + ':' + remote_dir, env.port) # transfer the code
with cd(remote_dir):
+ #run("env RAILS_ENV=production rake cache:clear") # clear memcache
run("rm -vf public/index.html public/about.html") # remove page caches on disk
- #run("env RAILS_ENV=production rake cache:clear") # clear memcache
- run("touch tmp/restart.txt") # restart passenger
- sudo("restart isbn.net.in") # delayed_job worker
+ run("touch tmp/restart.txt") # restart passenger
+ try:
+ sudo("stop isbn.net.in") # stop workers
+ except:
+ pass
+ sudo("cp -v upstart/* /etc/init/") # copy latest upstart files
+ run("rm -f tmp/pids/delayed_job*") # remove pids
+ sudo("start isbn.net.in") # start workers
puts(magenta('Success! The {0} server has been updated.'.format(env.host_string)))
@@ -4,6 +4,6 @@ respawn
env CODEDIR="/home/swaroop/web/isbn.net.in/private/isbn.net.in"
-exec su -l swaroop -c "cd $CODEDIR; export PORT=5000; bundle exec rake RAILS_ENV=production jobs:work >> /var/log/isbn.net.in/job-1.log 2>&1"
+exec su -l swaroop -c "cd $CODEDIR; export PORT=5000; bundle exec /usr/bin/env RAILS_ENV=production ./script/delayed_job -n 3 run >> /var/log/isbn.net.in/job-1.log 2>&1"
# vim: ft=upstart

0 comments on commit 7915ed1

Please sign in to comment.