http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/db/migrate/20121030184429_add_timestamps_to_blur_objects.rb ---------------------------------------------------------------------- diff --git a/contrib/blur-console-old/blur-admin/db/migrate/20121030184429_add_timestamps_to_blur_objects.rb b/contrib/blur-console-old/blur-admin/db/migrate/20121030184429_add_timestamps_to_blur_objects.rb new file mode 100644 index 0000000..ecf9325 --- /dev/null +++ b/contrib/blur-console-old/blur-admin/db/migrate/20121030184429_add_timestamps_to_blur_objects.rb @@ -0,0 +1,27 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +class AddTimestampsToBlurObjects < ActiveRecord::Migration + def change + change_table :blur_shards do |table| + table.timestamps + end + change_table :blur_controllers do |table| + table.timestamps + end + end +end
http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/db/migrate/20121220193623_add_admin_conifgurations_table.rb ---------------------------------------------------------------------- diff --git a/contrib/blur-console-old/blur-admin/db/migrate/20121220193623_add_admin_conifgurations_table.rb b/contrib/blur-console-old/blur-admin/db/migrate/20121220193623_add_admin_conifgurations_table.rb new file mode 100644 index 0000000..c88062e --- /dev/null +++ b/contrib/blur-console-old/blur-admin/db/migrate/20121220193623_add_admin_conifgurations_table.rb @@ -0,0 +1,26 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +class AddAdminConifgurationsTable < ActiveRecord::Migration + def change + create_table :admin_settings do |table| + table.column :setting, :string, :null => false + table.column :value, :string + table.timestamps + end + end +end http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/db/migrate/20130106191159_rename_status_columns.rb ---------------------------------------------------------------------- diff --git a/contrib/blur-console-old/blur-admin/db/migrate/20130106191159_rename_status_columns.rb b/contrib/blur-console-old/blur-admin/db/migrate/20130106191159_rename_status_columns.rb new file mode 100644 index 0000000..673a73a --- /dev/null +++ b/contrib/blur-console-old/blur-admin/db/migrate/20130106191159_rename_status_columns.rb @@ -0,0 +1,32 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +class RenameStatusColumns < ActiveRecord::Migration + def up + rename_column :blur_controllers, :status, :controller_status + rename_column :blur_shards, :status, :shard_status + rename_column :blur_tables, :status, :table_status + rename_column :zookeepers, :status, :zookeeper_status + end + + def down + rename_column :blur_controllers, :controller_status, :status + rename_column :blur_shards, :shard_status, :status + rename_column :blur_tables, :table_status, :status + rename_column :zookeepers, :status, :zookeeper_status + end +end http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/db/migrate/20130505151503_drop_licenses_table.rb ---------------------------------------------------------------------- diff --git a/contrib/blur-console-old/blur-admin/db/migrate/20130505151503_drop_licenses_table.rb b/contrib/blur-console-old/blur-admin/db/migrate/20130505151503_drop_licenses_table.rb new file mode 100644 index 0000000..2409c6c --- /dev/null +++ b/contrib/blur-console-old/blur-admin/db/migrate/20130505151503_drop_licenses_table.rb @@ -0,0 +1,33 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +class DropLicensesTable < ActiveRecord::Migration + def up + drop_table :licenses + end + + def down + create_table "licenses", :id => false, :force => true do |t| + t.string "org" + t.date "issued_date" + t.date "expires_date" + t.integer "node_overage" + t.integer "grace_period_days_remain" + t.integer "cluster_overage" + end + end +end http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/db/migrate/20130829031155_change_blur_queries_uuid_to_string.rb ---------------------------------------------------------------------- diff --git a/contrib/blur-console-old/blur-admin/db/migrate/20130829031155_change_blur_queries_uuid_to_string.rb b/contrib/blur-console-old/blur-admin/db/migrate/20130829031155_change_blur_queries_uuid_to_string.rb new file mode 100644 index 0000000..458f5a0 --- /dev/null +++ b/contrib/blur-console-old/blur-admin/db/migrate/20130829031155_change_blur_queries_uuid_to_string.rb @@ -0,0 +1,25 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +class ChangeBlurQueriesUuidToString < ActiveRecord::Migration + def up + change_column :blur_queries, :uuid, :string + end + + def down + change_column :blur_queries, :uuid, :limit => 8 + end +end http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/db/migrate/20130904130250_increase_size_of_query_times_json.rb ---------------------------------------------------------------------- diff --git a/contrib/blur-console-old/blur-admin/db/migrate/20130904130250_increase_size_of_query_times_json.rb b/contrib/blur-console-old/blur-admin/db/migrate/20130904130250_increase_size_of_query_times_json.rb new file mode 100644 index 0000000..ba9a21e --- /dev/null +++ b/contrib/blur-console-old/blur-admin/db/migrate/20130904130250_increase_size_of_query_times_json.rb @@ -0,0 +1,23 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with this +# work for additional information regarding copyright ownership. The ASF +# licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +class IncreaseSizeOfQueryTimesJson < ActiveRecord::Migration + def up + change_column :blur_queries, :times, :text + end + + def down + change_column :blur_queries, :times, :string + end +end http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/db/schema.rb ---------------------------------------------------------------------- diff --git a/contrib/blur-console-old/blur-admin/db/schema.rb b/contrib/blur-console-old/blur-admin/db/schema.rb new file mode 100644 index 0000000..88a4b9c --- /dev/null +++ b/contrib/blur-console-old/blur-admin/db/schema.rb @@ -0,0 +1,199 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# encoding: UTF-8 +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended to check this file into your version control system. + +ActiveRecord::Schema.define(:version => 20130904130250) do + + create_table "admin_settings", :force => true do |t| + t.string "setting", :null => false + t.string "value" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "audits", :force => true do |t| + t.integer "user_id" + t.string "mutation" + t.string "model_affected" + t.string "action" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "zookeeper_affected" + end + + create_table "blur_controllers", :force => true do |t| + t.integer "controller_status" + t.string "blur_version" + t.string "node_name" + t.integer "zookeeper_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "blur_controllers", ["zookeeper_id"], :name => "index_controllers_on_zookeeper_id" + + create_table "blur_queries", :force => true do |t| + t.text "query_string", :limit => 16777215 + t.integer "complete_shards" + t.string "uuid" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.boolean "super_query_on" + t.string "facets" + t.integer "start" + t.integer "fetch_num" + t.text "pre_filters", :limit => 16777215 + t.text "post_filters", :limit => 16777215 + t.text "selector_column_families" + t.text "selector_columns" + t.string "userid" + t.integer "blur_table_id" + t.text "times" + t.integer "total_shards" + t.integer "state" + t.boolean "record_only" + end + + add_index "blur_queries", ["blur_table_id"], :name => "index_blur_queries_on_blur_table_id" + + create_table "blur_shards", :force => true do |t| + t.integer "shard_status" + t.string "blur_version" + t.string "node_name" + t.integer "cluster_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "blur_shards", ["cluster_id"], :name => "index_shards_on_cluster_id" + + create_table "blur_tables", :force => true do |t| + t.string "table_name" + t.integer "current_size", :limit => 8 + t.integer "query_usage" + t.datetime "updated_at" + t.integer "record_count", :limit => 8 + t.integer "table_status" + t.string "table_uri" + t.text "table_analyzer" + t.text "table_schema" + t.text "server" + t.integer "cluster_id" + t.integer "row_count", :limit => 8 + t.string "comments" + end + + add_index "blur_tables", ["cluster_id"], :name => "index_blur_tables_on_cluster_id" + + create_table "clusters", :force => true do |t| + t.string "name" + t.integer "zookeeper_id" + t.boolean "safe_mode" + end + + add_index "clusters", ["zookeeper_id"], :name => "index_clusters_on_zookeeper_id" + + create_table "hdfs", :force => true do |t| + t.string "host" + t.string "port" + t.string "name" + end + + create_table "hdfs_stats", :force => true do |t| + t.integer "config_capacity", :limit => 8 + t.integer "present_capacity", :limit => 8 + t.integer "dfs_remaining", :limit => 8 + t.integer "dfs_used_real", :limit => 8 + t.float "dfs_used_percent" + t.integer "under_replicated", :limit => 8 + t.integer "corrupt_blocks", :limit => 8 + t.integer "missing_blocks", :limit => 8 + t.integer "total_nodes" + t.integer "dead_nodes" + t.datetime "created_at", :null => false + t.string "host" + t.string "port" + t.integer "hdfs_id" + t.integer "live_nodes" + t.integer "dfs_used_logical", :limit => 8 + end + + add_index "hdfs_stats", ["hdfs_id"], :name => "index_hdfs_stats_on_hdfs_id" + + create_table "preferences", :force => true do |t| + t.string "name" + t.string "pref_type" + t.text "value" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "user_id" + end + + add_index "preferences", ["user_id"], :name => "index_preferences_on_user_id" + + create_table "searches", :force => true do |t| + t.boolean "super_query" + t.text "columns" + t.integer "fetch" + t.integer "offset" + t.string "name" + t.string "query" + t.integer "blur_table_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.boolean "record_only", :default => false + t.text "pre_filter" + t.text "post_filter" + end + + add_index "searches", ["blur_table_id"], :name => "index_searches_on_blur_table_id" + add_index "searches", ["user_id"], :name => "index_searches_on_user_id" + + create_table "users", :force => true do |t| + t.string "username" + t.string "email" + t.string "crypted_password" + t.string "password_salt" + t.string "persistence_token" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "roles_mask" + t.string "name" + end + + create_table "zookeepers", :force => true do |t| + t.string "url" + t.string "name" + t.integer "zookeeper_status" + t.string "blur_urls", :limit => 4000 + t.string "online_ensemble_nodes" + end + +end http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/db/seeds.rb ---------------------------------------------------------------------- diff --git a/contrib/blur-console-old/blur-admin/db/seeds.rb b/contrib/blur-console-old/blur-admin/db/seeds.rb new file mode 100644 index 0000000..bcddc9d --- /dev/null +++ b/contrib/blur-console-old/blur-admin/db/seeds.rb @@ -0,0 +1,30 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with this +# work for additional information regarding copyright ownership. The ASF +# licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +# This file should contain all the record creation needed to seed the database with its default values. +# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). +# +# Examples: +# +# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }]) +# Mayor.create(:name => 'Daley', :city => cities.first) + +User.create({:username => 'admin', + :name => 'Delete Me', + :password => 'password', + :password_confirmation => + 'password', + :email => '[email protected]', + :roles_mask => 31}, :without_protection => true) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/lib/blur_thrift_client.rb ---------------------------------------------------------------------- diff --git a/contrib/blur-console-old/blur-admin/lib/blur_thrift_client.rb b/contrib/blur-console-old/blur-admin/lib/blur_thrift_client.rb new file mode 100644 index 0000000..e0aebfb --- /dev/null +++ b/contrib/blur-console-old/blur-admin/lib/blur_thrift_client.rb @@ -0,0 +1,28 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with this +# work for additional information regarding copyright ownership. The ASF +# licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +class BlurThriftClient + @@connections = {} + + # ["host:port","host2:port"] + def self.client(host_port) + if host_port.class == String + urls = host_port.split(/,/) + else + urls = Array(host_port) + end + ThriftClient.new Blur::Blur::Client, urls, :retries => 10 + end +end http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/lib/hdfs_thrift_client.rb ---------------------------------------------------------------------- diff --git a/contrib/blur-console-old/blur-admin/lib/hdfs_thrift_client.rb b/contrib/blur-console-old/blur-admin/lib/hdfs_thrift_client.rb new file mode 100644 index 0000000..bed9146 --- /dev/null +++ b/contrib/blur-console-old/blur-admin/lib/hdfs_thrift_client.rb @@ -0,0 +1,93 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with this +# work for additional information regarding copyright ownership. The ASF +# licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +class HdfsThriftClient + @@connections = {} + + def self.client(host_port) + socket = Thrift::Socket.new(host_port.split(":").first,host_port.split(":").last) + transport = Thrift::BufferedTransport.new(socket) + transport.open + protocol = Thrift::BinaryProtocol.new(transport) + client = ThriftHadoopFileSystem::Client.new(protocol) + + Client.new(client) + end + + class Client + def initialize(client) + @client = client + end + + def stat(path) + @client.stat(pathname(path)) + end + + def mkdirs(path) + @client.mkdirs(pathname(path)) + end + + def rename(from, to) + @client.rename(pathname(from),pathname(to)) + end + + def delete(path, recursive=false) + @client.rm pathname(path), recursive + end + + def put(local, remote) + handle = @client.create(pathname(remote)) + Kernel.open(local) { |source| + # read 1 MB at a time + while record = source.read(1048576) + @client.write(handle, record) + end + @client.close(handle) + } + end + + def ls(path, recursive=false) + statuses = @client.listStatus(pathname(path)) + return statuses unless recursive + statuses + statuses.select { |s| s.isdir }.map { |s| ls(s.path, recursive) }.flatten + end + + def folder_tree(path, depth) + if depth == 0 + return {:name => path, :size => folder_size(path)} + end + statuses = @client.listStatus(pathname(path)) + file_tree = {:name => path, :children => + statuses.map do |status| + status.isdir ? folder_tree(status.path, depth - 1) : {:name => status.path, :size => status.length} + end + } + end + + private + def pathname(path) + ThriftHadoopFileSystem::Pathname.new(:pathname => path.to_s) + end + + def folder_size(path) + statuses = @client.listStatus(pathname(path)) + size = 0 + statuses.each do |status| + size += status.isdir ? folder_size(status.path) : status.length + end + size + end + end +end http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/lib/pounder/pounder.rb ---------------------------------------------------------------------- diff --git a/contrib/blur-console-old/blur-admin/lib/pounder/pounder.rb b/contrib/blur-console-old/blur-admin/lib/pounder/pounder.rb new file mode 100644 index 0000000..cc2237f --- /dev/null +++ b/contrib/blur-console-old/blur-admin/lib/pounder/pounder.rb @@ -0,0 +1,76 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with this +# work for additional information regarding copyright ownership. The ASF +# licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +class Pounder + def self.run + # Setup object heirarchy + zk = Zookeeper.create!(:name => "Pounder-zk") + cluster = Cluster.create!(:name => "Pounder-cluster", :zookeeper => zk) + table = BlurTable.create!(:table_name => "Pounder-table", :table_status=> 0, :cluster => cluster) + + # Loop and add queries + threads = [] + + # Add new queries + threads << Thread.new(table) { |blur_table| + count = 0 + while count < 1000 + state = rand(3) + completed = 20 + if state == 0 || state == 1 + completed = 20 - rand(20) + end + query = BlurQuery.create!(:query_string => "query_#{count}", :uuid => count, :created_at => Time.now, :updated_at => Time.now, :blur_table => blur_table, :state => state, :total_shards => 20, :complete_shards => completed, :times => '{}') + puts "Query #{count} created: #{query.state_str}" + count = count + 1 + sleep(rand(6)) + end + } + + # Update running queries + threads << Thread.new(table) { |blur_table| + count = 0 + while count < 1000 + query = BlurQuery.where("state = 0 and blur_table_id = '#{blur_table.id}'").order("RAND()").first + + if query + state = rand(3) + completed = 20 + if state == 0 || state == 1 + completed = 20 - rand(20) + end + query.update_attributes!({:state => state, :complete_shards => completed, :updated_at => Time.now}) + puts "Query #{count} updated" + end + count = count + 1 + sleep(rand(6)) + end + } + + threads.each { |thread| thread.join } + + # Clean up objects + Zookeeper.destroy(zk.id) + end + + def self.clean + zk = Zookeeper.where("name = 'Pounder-zk'") + if !zk.empty? + zk.each do |z| + Zookeeper.destroy(z.id) + end + end + end +end \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/lib/tasks/coverage.rake ---------------------------------------------------------------------- diff --git a/contrib/blur-console-old/blur-admin/lib/tasks/coverage.rake b/contrib/blur-console-old/blur-admin/lib/tasks/coverage.rake new file mode 100644 index 0000000..50bfa7a --- /dev/null +++ b/contrib/blur-console-old/blur-admin/lib/tasks/coverage.rake @@ -0,0 +1,34 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + + +tests = [:models, :controllers, :helpers] +tests_tasks = tests.collect{ |type| "cov:#{type.to_s}" } + +namespace :cov do + tests.each do |type| + desc "Rspec with simplecov (#{type.to_s} only)" + task type do + ENV['COVERAGE'] = 'true' + ENV['PORTION'] = type.to_s + Rake::Task["spec:#{type}"].execute + end + end +end + +desc "Rspec with simplecov" +task :cov => tests_tasks \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/lib/tasks/pounder.rake ---------------------------------------------------------------------- diff --git a/contrib/blur-console-old/blur-admin/lib/tasks/pounder.rake b/contrib/blur-console-old/blur-admin/lib/tasks/pounder.rake new file mode 100644 index 0000000..4185537 --- /dev/null +++ b/contrib/blur-console-old/blur-admin/lib/tasks/pounder.rake @@ -0,0 +1,31 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + + +require 'pounder/pounder' + +namespace :pounder do + desc "Creates a continuous random set of queries into the database" + task :run => :environment do + Pounder.run + end + + desc "Clean up pounder data, for use when the pounder fails unexpectedly" + task :clean => :environment do + Pounder.clean + end +end \ No newline at end of file
