[Groonga-commit] droonga/wikipedia-search at 335fab6 [master] Add local:droonga:run task that runs Droonga cluster

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Apr 8 12:41:50 JST 2014


Kouhei Sutou	2014-04-08 12:41:50 +0900 (Tue, 08 Apr 2014)

  New Revision: 335fab6caaf39a3860050347dc98dbb4aaaa8622
  https://github.com/droonga/wikipedia-search/commit/335fab6caaf39a3860050347dc98dbb4aaaa8622

  Message:
    Add local:droonga:run task that runs Droonga cluster

  Modified files:
    lib/wikipedia-search/task.rb

  Modified: lib/wikipedia-search/task.rb (+22 -3)
===================================================================
--- lib/wikipedia-search/task.rb    2014-04-07 18:58:10 +0900 (e9bc9f3)
+++ lib/wikipedia-search/task.rb    2014-04-08 12:41:50 +0900 (3183cc7)
@@ -155,16 +155,17 @@ module WikipediaSearch
 
     def define_local_droonga_tasks
       namespace :droonga do
-        dependencies = [
+        node_ids = [0, 1]
+
+        load_dependencies = [
           @path.droonga.pages.to_s,
           @path.droonga.schema.to_s,
         ]
         desc "Load data."
-        task :load => dependencies do
+        task :load => load_dependencies do
           rm_rf(@path.droonga.working_dir.to_s)
           mkdir_p(@path.droonga.working_dir.to_s)
 
-          node_ids = [0, 1]
           node_ids.each do |node_id|
             droonga_generate_fluentd_conf(node_id)
           end
@@ -188,6 +189,24 @@ module WikipediaSearch
             end
           end
         end
+
+        desc "Run Droonga cluster."
+        task :run do
+          begin
+            node_ids.each do |node_id|
+              droonga_run_engine(node_id)
+              port = droonga_port(node_id)
+              puts("127.0.0.1:#{port}/droonga")
+            end
+            front_node_id = node_ids.first
+            droonga_wait_engine_ready(front_node_id)
+            $stdin.gets
+          ensure
+            node_ids.each do |node_id|
+              droonga_stop_engine(node_id)
+            end
+          end
+        end
       end
     end
 
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index