Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Paweł Paprota
committed
Sep 29, 2013
1 parent
560901b
commit 85198f8
Showing
29 changed files
with
1,326 additions
and
4,067 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
class AdminController < ActionController::Base | ||
protect_from_forgery | ||
|
||
def spawn_workers | ||
#post_params[] | ||
#TilerWorker.perform_async(params[:changeset_id]) | ||
sql = 'SELECT DISTINCT changeset_id AS id FROM nodes LIMIT 100' | ||
|
||
for row in ActiveRecord::Base.connection.execute(sql) do | ||
TilerWorker.perform_async(row['id'].to_i) | ||
end | ||
|
||
redirect_to '/admin' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,26 @@ | ||
class TilerWorker | ||
include SidekiqStatus::Worker | ||
include Sidekiq::Worker | ||
#include SidekiqStatus::Worker | ||
|
||
sidekiq_options :retry => false | ||
|
||
def perform(name, count) | ||
zoom = 16 | ||
changeset_ids = [] | ||
|
||
conn = ActiveRecord::Base.connection.raw_connection() | ||
#conn.set_error_verbosity(0) | ||
tiler = Tiler::ChangesetTiler.new(conn) | ||
|
||
changeset_ids.each_with_index do |changeset_id, count| | ||
next if changeset_id == 0 | ||
def initialize | ||
@conn = ActiveRecord::Base.connection.raw_connection() | ||
@conn.set_error_verbosity(0) | ||
@tiler = Tiler::ChangesetTiler.new(@conn) | ||
end | ||
|
||
# Print out some diagnostic information. | ||
if count % 1000 == 0 | ||
GC.start | ||
p GC::stat | ||
p GC::Profiler.result | ||
p GC::Profiler.total_time | ||
GC::Profiler.report | ||
end | ||
def perform(changeset_id) | ||
zoom = 16 | ||
before = Time.now | ||
puts "Generating tiles for changeset #{changeset_id}..." | ||
tile_count = @tiler.generate(zoom, changeset_id, {}) | ||
puts "Done, tile count: #{tile_count}" | ||
puts "Changeset #{changeset_id} took #{Time.now - before}s" | ||
{ tiles: tile_count } | ||
end | ||
|
||
before = Time.now | ||
puts "Generating tiles for changeset #{changeset_id}... (#{count})" | ||
tile_count = tiler.generate(zoom, changeset_id, options) | ||
puts "Done, tile count: #{tile_count}" | ||
puts "Changeset #{changeset_id} took #{Time.now - before}s (#{count})" | ||
end | ||
def self.job_name(changeset_id) | ||
changeset_id | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
class CreateSidekiqJobs < ActiveRecord::Migration | ||
def change | ||
create_table :sidekiq_jobs do |t| | ||
t.string :jid | ||
t.string :queue | ||
t.string :class_name | ||
t.text :args | ||
t.boolean :retry | ||
t.datetime :enqueued_at | ||
t.datetime :started_at | ||
t.datetime :finished_at | ||
t.string :status | ||
t.string :name | ||
t.text :result | ||
end | ||
|
||
add_index :sidekiq_jobs, :jid | ||
add_index :sidekiq_jobs, :queue | ||
add_index :sidekiq_jobs, :retry | ||
add_index :sidekiq_jobs, :class_name | ||
add_index :sidekiq_jobs, :enqueued_at | ||
add_index :sidekiq_jobs, :started_at | ||
add_index :sidekiq_jobs, :finished_at | ||
add_index :sidekiq_jobs, :status | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.