Skip to content

Commit

Permalink
Sidekiq looks for workers in /workers not /jobs. Everything now works…
Browse files Browse the repository at this point in the history
… 100%.
  • Loading branch information
philippbayer committed Mar 8, 2013
1 parent dec2bf9 commit 540ab48
Show file tree
Hide file tree
Showing 31 changed files with 54 additions and 75 deletions.
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ gem 'friendly_id', :git => 'git://github.com/norman/friendly_id.git'
gem 'recommendify',:git => 'git://github.com/paulasmuth/recommendify.git', :ref => "34308c4"

# for jobs
gem 'resque', '1.23.0'
gem 'sidekiq'
gem 'slim'
gem 'sinatra'

#group :production do
# gem 'rpm_contrib'
Expand Down
39 changes: 19 additions & 20 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
GIT
remote: git://github.com/nevans/resque-pool.git
revision: 96218b25fabbcbe58a109135706611a33158ba13
specs:
resque-pool (0.4.0.dev)
rake
resque (~> 1.20)
trollop (~> 1.16)

GIT
remote: git://github.com/norman/friendly_id.git
revision: cb0c987be9cc36fea581ba56b321f8790f0b1c50
Expand Down Expand Up @@ -90,11 +81,15 @@ GEM
net-sftp (>= 2.0.0)
net-ssh (>= 2.0.14)
net-ssh-gateway (>= 1.1.0)
celluloid (0.12.4)
facter (>= 1.6.12)
timers (>= 1.0.0)
climate_control (0.0.3)
activesupport (>= 3.0)
cocaine (0.5.1)
climate_control (>= 0.0.3, < 1.0)
columnize (0.3.6)
connection_pool (1.0.0)
debugger (1.3.3)
columnize (>= 0.3.1)
debugger-linecache (~> 1.1.1)
Expand All @@ -104,6 +99,7 @@ GEM
debugger-ruby_core_source (1.2.0)
dynamic_form (1.1.4)
erubis (2.7.0)
facter (1.6.17)
factory_girl (4.2.0)
activesupport (>= 3.0.0)
fitgem (0.6.0)
Expand Down Expand Up @@ -181,13 +177,6 @@ GEM
redis (3.0.2)
redis-namespace (1.2.1)
redis (~> 3.0.0)
resque (1.23.0)
multi_json (~> 1.0)
redis-namespace (~> 1.0)
sinatra (>= 0.9.2)
vegas (~> 0.1.2)
resque-loner (1.2.1)
resque (~> 1.0)
rest-client (1.6.7)
mime-types (>= 1.16)
rsolr (1.0.8)
Expand All @@ -198,6 +187,12 @@ GEM
sanitize (2.0.3)
nokogiri (>= 1.4.4, < 1.6)
shoulda-context (1.0.2)
sidekiq (2.8.0)
celluloid (~> 0.12.0)
connection_pool (~> 1.0)
multi_json (~> 1)
redis (~> 3)
redis-namespace
simplecov (0.7.1)
multi_json (~> 1.0)
simplecov-html (~> 0.7.1)
Expand All @@ -206,6 +201,9 @@ GEM
rack (~> 1.4)
rack-protection (~> 1.3)
tilt (~> 1.3, >= 1.3.3)
slim (1.3.6)
temple (~> 0.5.5)
tilt (~> 1.3.3)
sprockets (2.2.2)
hike (~> 1.2)
multi_json (~> 1.0)
Expand All @@ -218,12 +216,13 @@ GEM
nokogiri
sunspot (= 1.3.3)
sunspot_solr (1.3.3)
temple (0.5.5)
thor (0.17.0)
tilt (1.3.3)
timers (1.1.0)
treetop (1.4.12)
polyglot
polyglot (>= 0.3.1)
trollop (1.16.2)
tzinfo (0.3.35)
vegas (0.1.11)
rack (>= 1.0.0)
Expand Down Expand Up @@ -257,14 +256,14 @@ DEPENDENCIES
rails3-generators
recaptcha
recommendify!
resque (= 1.23.0)
resque-loner
resque-pool!
rubyzip (= 0.9.5)
rvm-capistrano
sanitize
shoulda-context
sidekiq
simplecov
sinatra
slim
sunspot_rails
sunspot_solr
sunspot_test!
Expand Down
1 change: 0 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require 'resque/tasks'
require File.expand_path('../config/application', __FILE__)
require 'rake'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require 'resque'

class DeleteGenotype
include Sidekiq::Worker
sidekiq_options :queue => :deletegenotype
Expand Down
2 changes: 1 addition & 1 deletion app/jobs/fitbit_dump.rb → app/workers/fitbit_dump.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'resque'


class FitbitDump
include Sidekiq::Worker
Expand Down
2 changes: 1 addition & 1 deletion app/jobs/fitbit_edit.rb → app/workers/fitbit_edit.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'resque'


class FitbitEdit
include Sidekiq::Worker
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'resque'


class FitbitEndSubscription
include Sidekiq::Worker
Expand Down
2 changes: 1 addition & 1 deletion app/jobs/fitbit_init.rb → app/workers/fitbit_init.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'resque'


class FitbitInit
include Sidekiq::Worker
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'resque'


class FitbitNotification
include Sidekiq::Worker
Expand Down
8 changes: 4 additions & 4 deletions app/jobs/fixphenotypes.rb → app/workers/fixphenotypes.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'resque'


class Fixphenotypes
include Sidekiq::Worker
Expand All @@ -14,8 +14,8 @@ def perform()
# delete!
log "Deleting phenotype '" + p.characteristic
Phenotype.destroy(p)
Resque.enqueue(Recommendvariations)
Resque.enqueue(Recommendphenotypes)
Sidekiq::Client.enqueue(Recommendvariations)
Sidekiq::Client.enqueue(Recommendphenotypes)
next
end

Expand All @@ -30,7 +30,7 @@ def perform()

end

def self.log msg
def log msg
Rails.logger.info "#{DateTime.now}: #{msg}"
end
end
2 changes: 1 addition & 1 deletion app/jobs/frequency.rb → app/workers/frequency.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'resque'


class Frequency
include Sidekiq::Worker
Expand Down
2 changes: 0 additions & 2 deletions app/jobs/genomegov.rb → app/workers/genomegov.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
require 'resque'
require 'open-uri'
require 'iconv'

class GenomeGov
include Sidekiq::Worker
include Resque::Plugins::UniqueJob
sidekiq_options :queue => :genomegov

def perform()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
require 'resque'


class Mailnewphenotype
include Sidekiq::Worker
sidekiq_options :queue => :mailnewgenotype
sidekiq_options :queue => :mailnewgenotype, :retry => false # avoid spam on breakage

def perform(phenotype_id,user_id)
@phenotype = Phenotype.find_by_id(phenotype_id)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
require "resque"
require "rubygems"
require "net/http"
require "json"

class MendeleySearch
include Sidekiq::Worker
include Resque::Plugins::UniqueJob
sidekiq_options :queue => :mendeley

def perform(snp_id)
Expand Down Expand Up @@ -83,7 +81,7 @@ def perform(snp_id)
)
end
end
Resque.enqueue(MendeleyDetails, @mendeley_paper.id)
Sidekiq::Client.enqueue(MendeleyDetails, @mendeley_paper.id)
end
else
puts "mendeley: No papers found"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require "resque"
require "rubygems"
require "net/http"
require "json"
Expand Down
4 changes: 2 additions & 2 deletions app/jobs/parsing.rb → app/workers/parsing.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'resque'


class Parsing
include Sidekiq::Worker
Expand Down Expand Up @@ -132,7 +132,7 @@ def perform(genotype_id, temp_file)
end
end

def self.log msg
def log msg
Rails.logger.info "#{DateTime.now}: #{msg}"
end
end
3 changes: 1 addition & 2 deletions app/jobs/pgpannotation.rb → app/workers/pgpannotation.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
require 'resque'

require 'open-uri'

class PgpAnnotationjob
include Sidekiq::Worker
include Resque::Plugins::UniqueJob
sidekiq_options :queue => :pgp

def perform()
Expand Down
5 changes: 2 additions & 3 deletions app/jobs/plos.rb → app/workers/plos.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
require 'resque'

require 'net/http'
require 'rexml/document'

class Plos
include Sidekiq::Worker
include Resque::Plugins::UniqueJob
sidekiq_options :queue => :plos

def perform(snp_id)
Expand Down Expand Up @@ -44,7 +43,7 @@ def perform(snp_id)
print "-> paper is old"
@plos_paper = PlosPaper.find_by_doi(doi)
end
Resque.enqueue(PlosDetails,@plos_paper)
Sidekiq::Client.enqueue(PlosDetails,@plos_paper)
end
else
print "plos: none found\n"
Expand Down
1 change: 0 additions & 1 deletion app/jobs/plosdetails.rb → app/workers/plosdetails.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require "resque"
require "rubygems"
require "net/http"
require "json"
Expand Down
6 changes: 3 additions & 3 deletions app/jobs/preparsing.rb → app/workers/preparsing.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'resque'

require 'digest'

class Preparsing
Expand Down Expand Up @@ -149,11 +149,11 @@ def perform(genotype_id)

temp_files = Dir.glob("tmp/#{@genotype.id}_tmpfile*")
temp_files.each do |single_temp_file|
Resque.enqueue(Parsing, @genotype.id, single_temp_file)
Sidekiq::Client.enqueue(Parsing, @genotype.id, single_temp_file)
end
end
end
def self.log msg
def log msg
Rails.logger.info "#{DateTime.now}: #{msg}"
end
end
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'resque'

require "recommendify"
Recommendify.redis = Redis.new

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'resque'

require "recommendify"
Recommendify.redis = Redis.new

Expand Down
2 changes: 0 additions & 2 deletions app/jobs/snpedia.rb → app/workers/snpedia.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
require 'resque'
require 'net/http'
require 'rexml/document'
require 'media_wiki'

class Snpedia
include Sidekiq::Worker
include Resque::Plugins::UniqueJob
sidekiq_options :queue => :snpedia

def perform(snp_id)
Expand Down
4 changes: 2 additions & 2 deletions app/jobs/zipfulldata.rb → app/workers/zipfulldata.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'resque'

require 'csv'

class Zipfulldata
Expand Down Expand Up @@ -261,7 +261,7 @@ def log(msg)
self.class.log(msg)
end

def self.log(msg)
def log(msg)
Rails.logger.info "#{DateTime.now}: #{msg}"
end
end
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'resque'


class Zipgenotypingfiles
include Sidekiq::Worker
Expand Down
4 changes: 1 addition & 3 deletions config.ru
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
require ::File.expand_path('../config/environment', __FILE__)

require 'resque/server'
run Rack::URLMap.new \
"/" => Snpr::Application,
"/resque" => Resque::Server.new
"/" => Snpr::Application
4 changes: 0 additions & 4 deletions config/initializers/resque.rb

This file was deleted.

4 changes: 4 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require 'sidekiq/web'
Snpr::Application.routes.draw do
resources :static
resources :phenotypes do
Expand Down Expand Up @@ -73,6 +74,9 @@
match '/user_picture_phenotypes/:id/delete', :to => 'user_picture_phenotypes#delete'

root :to => 'index#index' # change this, maybe

mount Sidekiq::Web, at: '/sidekiq'

# The priority is based upon order of creation:
# first created -> highest priority.

Expand Down
6 changes: 0 additions & 6 deletions lib/tasks/resque.rake

This file was deleted.

2 changes: 1 addition & 1 deletion serverscript
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
screen -d -m -S "Server" bundle exec rails s
screen -d -m -S "Solr" bundle exec rake sunspot:solr:run
screen -d -m -S "Redis" redis-server
screen -d -m -S "Resque-worker" bundle exec rake environment resque:work QUEUE=*
screen -d -m -S "Sidekiq" bundle exec sidekiq -q preparse,2 -q parse,2 -q deletegenotype -q fitbitdump -q fitbitedit -q fitbitendsubscription -q fitbitinit -q fitbitnotification -q fixphenotypes -q frequency -q genomegov -q mailnewgenotype -q mendeley_details -q mendeley -q pgp -q plos_details -q plos -q zipfulldata -q snpedia -q zipgenotyping
Loading

0 comments on commit 540ab48

Please sign in to comment.