Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

latest stuffs

  • Loading branch information...
commit 12bf65e1de2296c0e9eb850047c036f864866cdd 1 parent 27b64fd
@carimura carimura authored
View
4 .gitignore
@@ -2,6 +2,7 @@
*.rbc
.bundle
.config
+.idea
coverage
InstalledFiles
lib/bundler/man
@@ -11,6 +12,9 @@ spec/reports
test/tmp
test/version_tmp
tmp
+iron.json
+run.rb
+
# YARD artifacts
.yardoc
View
26 koder_master.rb
@@ -0,0 +1,26 @@
+require 'iron_worker_ng'
+require 'iron_cache'
+require 'rest'
+require 'json'
+
+options = {}
+url = "https://api.stackexchange.com/2.1/users?order=desc&sort=reputation&site=stackoverflow"
+rest = Rest::Client.new(:gem => :typhoeus)
+cache = IronCache::Client.new(:token => params[:token], :project_id => params[:project_id])
+worker = IronWorkerNG::Client.new(:token => params[:token], :project_id => params[:project_id])
+
+koders = cache.cache("koders")
+user_ids = []
+
+res = rest.get(url, options)
+results = JSON.parse(res.body)
+
+results["items"].each do |i|
+ puts "Found user #{i["display_name"]}"
+ koders.put(i["user_id"].to_s, i.to_s)
+ user_ids << i["user_id"]
+
+ worker.tasks.create("koder_slave", :user_id => i["user_id"])
+end
+
+puts "Processed #{user_ids.size} users"
View
7 koder_master.worker
@@ -0,0 +1,7 @@
+runtime "ruby"
+exec "koder_master.rb"
+
+gem "rest"
+gem "iron_cache"
+gem "iron_worker_ng"
+gem "json"
View
3  koder_slave.rb
@@ -0,0 +1,3 @@
+
+puts "Got id --> #{params[:user_id]}"
+
View
4 koder_slave.worker
@@ -0,0 +1,4 @@
+runtime "ruby"
+exec "koder_slave.rb"
+
+gem "json"
Please sign in to comment.
Something went wrong with that request. Please try again.