drbqs 0.0.15 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. data/.document +3 -0
  2. data/README.md +137 -128
  3. data/VERSION +1 -1
  4. data/docs/FormatExecute.md +119 -0
  5. data/docs/GettingStarted.md +242 -0
  6. data/drbqs.gemspec +36 -13
  7. data/example/command/server_def.rb +4 -5
  8. data/example/execute/execute.rb +41 -0
  9. data/example/execute/server.rb +14 -0
  10. data/example/execute/task.rb +0 -0
  11. data/example/mandelbrot/README.md +15 -0
  12. data/example/mandelbrot/execute.rb +10 -0
  13. data/example/mandelbrot/mandelbrot.rb +56 -0
  14. data/example/mandelbrot/server.rb +49 -0
  15. data/example/server/server.rb +3 -6
  16. data/example/simple/README.md +18 -0
  17. data/example/simple/execute.rb +11 -0
  18. data/example/simple/server.rb +8 -0
  19. data/example/simple/task.rb +11 -0
  20. data/example/sum/server_def.rb +1 -1
  21. data/example/sum2/execute_def.rb +21 -8
  22. data/example/sum2/server_def.rb +8 -7
  23. data/example/transfer/file.rb +42 -8
  24. data/example/transfer/server_def.rb +43 -9
  25. data/lib/drbqs.rb +1 -1
  26. data/lib/drbqs/command_line/command_execute.rb +3 -3
  27. data/lib/drbqs/command_line/command_line.rb +1 -1
  28. data/lib/drbqs/execute/execute_node.rb +50 -0
  29. data/lib/drbqs/execute/process_define.rb +102 -54
  30. data/lib/drbqs/execute/register.rb +241 -87
  31. data/lib/drbqs/execute/server_define.rb +69 -58
  32. data/lib/drbqs/ext/task.rb +2 -0
  33. data/lib/drbqs/ext/task/command_task.rb +43 -0
  34. data/lib/drbqs/manage/manage.rb +5 -4
  35. data/lib/drbqs/manage/ssh_shell.rb +2 -8
  36. data/lib/drbqs/node/connection.rb +1 -1
  37. data/lib/drbqs/node/node.rb +8 -14
  38. data/lib/drbqs/node/task_client.rb +1 -1
  39. data/lib/drbqs/server/history.rb +5 -1
  40. data/lib/drbqs/server/message.rb +7 -34
  41. data/lib/drbqs/server/queue.rb +14 -2
  42. data/lib/drbqs/server/server.rb +86 -43
  43. data/lib/drbqs/server/server_hook.rb +3 -0
  44. data/lib/drbqs/server/test/node.rb +1 -1
  45. data/lib/drbqs/server/test/prof.rb +50 -0
  46. data/lib/drbqs/server/test/server.rb +2 -2
  47. data/lib/drbqs/server/transfer_setting.rb +23 -11
  48. data/lib/drbqs/setting/base.rb +15 -0
  49. data/lib/drbqs/setting/data_container.rb +1 -1
  50. data/lib/drbqs/setting/execute.rb +3 -3
  51. data/lib/drbqs/setting/node.rb +1 -1
  52. data/lib/drbqs/setting/server.rb +2 -2
  53. data/lib/drbqs/task/registrar.rb +39 -0
  54. data/lib/drbqs/task/task.rb +139 -59
  55. data/lib/drbqs/task/task_generator.rb +93 -116
  56. data/lib/drbqs/utility/misc.rb +15 -10
  57. data/lib/drbqs/utility/temporary.rb +7 -2
  58. data/lib/drbqs/utility/transfer/transfer.rb +81 -0
  59. data/lib/drbqs/utility/transfer/transfer_client.rb +68 -69
  60. data/lib/drbqs/utility/transfer/transfer_client_connect.rb +83 -0
  61. data/lib/drbqs/utility/transfer/transfer_file_list.rb +40 -0
  62. data/spec/execute/def/execute1.rb +4 -4
  63. data/spec/execute/def/execute2.rb +24 -0
  64. data/spec/execute/process_define_spec.rb +43 -6
  65. data/spec/execute/register_spec.rb +403 -9
  66. data/spec/execute/server_define_spec.rb +1 -1
  67. data/spec/ext/task/command_task_spec.rb +16 -0
  68. data/spec/integration_test/01_basic_usage_spec.rb +1 -1
  69. data/spec/integration_test/02_use_generator_spec.rb +2 -2
  70. data/spec/integration_test/04_use_unix_domain_spec.rb +1 -1
  71. data/spec/integration_test/05_server_exit_signal_spec.rb +1 -1
  72. data/spec/integration_test/06_node_exit_after_task_spec.rb +4 -4
  73. data/spec/integration_test/08_shutdown_unused_nodes_spec.rb +2 -2
  74. data/spec/integration_test/09_server_process_data_spec.rb +1 -1
  75. data/spec/integration_test/definition/server01.rb +4 -5
  76. data/spec/integration_test/definition/server02.rb +2 -4
  77. data/spec/node/node_spec.rb +34 -0
  78. data/spec/server/message_spec.rb +1 -1
  79. data/spec/server/queue_spec.rb +34 -7
  80. data/spec/server/server_spec.rb +21 -9
  81. data/spec/server/transfer_setting_spec.rb +59 -24
  82. data/spec/setting/base_spec.rb +11 -0
  83. data/spec/setting/data_container_spec.rb +8 -0
  84. data/spec/spec_helper.rb +1 -7
  85. data/spec/task/registrar_spec.rb +34 -0
  86. data/spec/task/task_generator_spec.rb +15 -15
  87. data/spec/task/task_spec.rb +132 -23
  88. data/spec/utility/misc_spec.rb +2 -2
  89. data/spec/utility/transfer/transfer_client_connect_spec.rb +90 -0
  90. data/spec/utility/transfer/transfer_file_list_spec.rb +27 -0
  91. data/spec/{task/file_transfer_spec.rb → utility/transfer/transfer_spec.rb} +24 -24
  92. metadata +66 -45
  93. data/lib/drbqs/manage/execute_node.rb +0 -50
  94. data/lib/drbqs/server/prof.rb +0 -48
  95. data/lib/drbqs/task/command_task.rb +0 -43
  96. data/lib/drbqs/utility/transfer/file_transfer.rb +0 -73
@@ -0,0 +1,242 @@
1
+ # Getting started
2
+
3
+ ## Outline
4
+
5
+ We use example/mandelbrot as an example for use of DRbQS.
6
+ To use DRbQS we needs two files: a file to define class for tasks
7
+ and a file to define a server.
8
+ In addition, it is convenient to create a file
9
+ to define processes of a server and nodes.
10
+
11
+ ## Example
12
+
13
+ ### Class to calculate tasks: mandelbrot.rb
14
+
15
+ require 'complex'
16
+
17
+ class Mandelbrot
18
+ def initialize(iterate, threshold)
19
+ @iterate = iterate
20
+ @threshold = threshold
21
+ end
22
+
23
+ def map(z, c)
24
+ z * z + c
25
+ end
26
+
27
+ def iterate_map(z, c, &block)
28
+ z_old = z
29
+ @iterate.times do |i|
30
+ z_new = map(z_old, c)
31
+ z_old = z_new
32
+ yield(z_old) if block_given?
33
+ end
34
+ z_old
35
+ end
36
+
37
+ def diverge?(c)
38
+ iterate_map(Complex(0.0, 0.0), c) do |z|
39
+ if z.abs > @threshold
40
+ return true
41
+ end
42
+ end
43
+ false
44
+ end
45
+ end
46
+
47
+ class CalcMandelbrot
48
+ def initialize(mandelbrot)
49
+ @mandelbrot = mandelbrot
50
+ end
51
+
52
+ def calc(io, xrange, yrange, step_size)
53
+ xrange.step(step_size) do |x|
54
+ yrange.step(step_size) do |y|
55
+ c = Complex(x, y)
56
+ unless @mandelbrot.diverge?(c)
57
+ io.puts "#{c.real}\t#{c.imag}"
58
+ end
59
+ end
60
+ end
61
+ end
62
+
63
+ def calc_save(basename, *args)
64
+ file = DRbQS::Temporary.file
65
+ open(file, 'w') do |f|
66
+ calc(f, *args)
67
+ end
68
+ DRbQS::Transfer.enqueue(file, compress: true, rename: basename) # Return basename.
69
+ end
70
+ end
71
+
72
+
73
+ ### Server: server.rb
74
+
75
+ require_relative 'mandelbrot.rb'
76
+
77
+ RESULT_DIR = 'result_mandelbrot'
78
+
79
+ DRbQS.option_parser("Calculate Mandelbrot set.") do |prs, opts|
80
+ prs.on('-s NUM', '--step NUM', Float, 'Set the step size.') do |v|
81
+ opts[:step] = v
82
+ end
83
+ prs.on('-l NUM', '--limit NUM', Float, 'Set the limit to search.') do |v|
84
+ opts[:limit] = v
85
+ end
86
+ prs.on('-i NUM', '--iterate NUM', Integer, 'Set the iterate number.') do |v|
87
+ opts[:iterate] = v
88
+ end
89
+ prs.on('-t NUM', '--threshold NUM', Float, 'Set the threshold value.') do |v|
90
+ opts[:threshold] = v
91
+ end
92
+ end
93
+
94
+ DRbQS.define_server(file_directory: RESULT_DIR) do |server, argv, opts|
95
+ step_size = opts[:step] || 0.1
96
+ limit = opts[:limit] || 2.0
97
+ iterate = opts[:iterate] || 1000
98
+ threshold = opts[:threshold] || 5
99
+
100
+ mandelbrot = Mandelbrot.new(iterate, threshold)
101
+ calc = CalcMandelbrot.new(mandelbrot)
102
+
103
+ ranges = [[-limit..0, -limit..0, step_size], [-limit..0, 0..limit, step_size],
104
+ [0..limit, -limit..0, step_size], [0..limit, 0..limit, step_size]]
105
+ ranges.each_with_index do |ranges, i|
106
+ args_ary = ["%02d.txt" % i] + ranges
107
+ note_str = "#{ranges[0].inspect} #{ranges[1].inspect}"
108
+ task = DRbQS::Task.new(calc, :calc_save, args: args_ary, note: note_str) do |srv, result|
109
+ DRbQS::Transfer.decompress(srv, result)
110
+ end
111
+ server.queue.add(task)
112
+ end
113
+ server.add_hook(:finish) do |srv|
114
+ puts "Save results to #{RESULT_DIR}"
115
+ result_path = File.join(RESULT_DIR, "result.txt")
116
+ Dir.glob(File.join(RESULT_DIR, "*.txt")).sort.each do |path|
117
+ open(result_path, 'a+') do |out|
118
+ out.print File.read(path)
119
+ end
120
+ FileUtils.rm(path)
121
+ end
122
+ end
123
+ end
124
+
125
+ ### Definition of processes (optional): execute.rb
126
+
127
+ DIR = File.dirname(__FILE__)
128
+
129
+ server :local_server, "localhost" do |srv|
130
+ srv.load File.join(DIR, 'server.rb')
131
+ end
132
+
133
+ node :local_node do |nd|
134
+ nd.load File.join(DIR, 'mandelbrot.rb')
135
+ nd.process 2 # For dual core CPU
136
+ end
137
+
138
+ ## mandelbrot.rb
139
+
140
+ This file defines class Mandelbrot and CalcMandelbrot.
141
+ The class CalcMandelbrot and its method calc\_save are for DRbQS::Task.
142
+ In the method calc\_save we creates a temporary file by DRbQS::Temporary.file
143
+ and save results to the file.
144
+ Then, we rename the temporary file and add it to queue of transferring.
145
+ The method calc\_save returns basename of the file transferred to the server
146
+ and the returned value will become an argument of hook of the task on the server.
147
+
148
+ ## Definition of server
149
+
150
+ ### A file for drbqs-server
151
+
152
+ The command "drbqs-server" takes a ruby file that defines a DRbQS server
153
+ and gets settings of the server (port number, settings of sftp, and so on)
154
+ from options of command line.
155
+ In the definition file we load necessary files to process tasks,
156
+ set a parser of command line arguments for the server
157
+ by the method "DRbQS.option\_parser",
158
+ and defines the body of server by the method "DRbQS.define\_server".
159
+
160
+ ### DRbQS.option_parser
161
+
162
+ DRbQS.option_parser takes a block that has two arguments.
163
+ The first argument is a OptionParser object and
164
+ the second argument is a hash
165
+ that is used to save data from options of command line.
166
+
167
+ ### DRbQS.define_server
168
+
169
+ The block of DRbQS.define\_server takes three arguments.
170
+ An argument of DRbQS.define\_server is the same as DRbQS::Server.new and
171
+ the first block argument is an object of DRbQS::Server.
172
+ the second block argument is ARGV parsed by DRbQS.option_parser and
173
+ the third block argument is the second block argument of DRbQS.option\_parser.
174
+ Using these variables, we can get arguments from command line.
175
+
176
+ We set tasks on the block of DRbQS.define\_server.
177
+ We create tasks by DRbQS::Task.new and
178
+ add them to queue of the server as the following
179
+
180
+ server.queue.add(task)
181
+
182
+ In the block of DRbQS::Task.new
183
+ we decompress files transferred from nodes.
184
+ Then, when server finishes, :finish hook concatenates the files of results.
185
+
186
+ ### Execute a server
187
+
188
+ To execute the server of which port number is 12345,
189
+ we type the following on terminal.
190
+
191
+ drbqs-server server.rb -p 12345
192
+
193
+ We can set options of the server.
194
+ First, we confirm the options of the server.
195
+
196
+ drbqs-server server.rb -h
197
+
198
+ The help messages are displayed.
199
+
200
+ We set the options of the command drbqs-server, add '--',
201
+ and set the options of the server.
202
+
203
+ For example,
204
+
205
+ drbqs-server server.rb --execute-node 2 -- --limit 3.0 --step 0.1
206
+
207
+ The option --execute-node is useful,
208
+ it executes also nodes connecting to the server just after the server runs.
209
+
210
+ ## Execute nodes
211
+
212
+ If the server runs with port 12345, then the command
213
+
214
+ drbqs-node -l mandelbrot.rb druby://:12345
215
+
216
+ connects to the server of druby://:12345 and calculate tasks obtained from the server.
217
+ If we want to execute two node processes then we use either -P or -process option.
218
+ The command
219
+
220
+ drbqs-node -P 2 -l mandelbrot.rb druby://:12345
221
+
222
+ execute two node processes.
223
+
224
+ If the calculation finishes, we find the directory 'result_mandelbrot'
225
+ including 'result.txt'.
226
+
227
+ ## Execution over SSH
228
+
229
+ For example, if we want to execute on example.com then we type
230
+
231
+ drbqs-ssh server user@example.com -d /path/to/mandelbrot -- server.rb -- --limit 3.0 --step 0.1
232
+
233
+ and
234
+
235
+ drbqs-ssh node user@example.com -d /path/to/mandelbrot -- -l mandelbrot.rb -P 2
236
+
237
+ ## Execute a server and nodes all together
238
+
239
+ We can execute a server and nods simultaneously as daemon processes.
240
+ We type the following
241
+
242
+ drbqs-execute execute.rb
data/drbqs.gemspec CHANGED
@@ -5,14 +5,14 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{drbqs}
8
- s.version = "0.0.15"
8
+ s.version = "0.0.16"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Takayuki YAMAGUCHI"]
12
- s.date = %q{2011-07-29}
11
+ s.authors = [%q{Takayuki YAMAGUCHI}]
12
+ s.date = %q{2011-08-03}
13
13
  s.description = %q{Task queuing system over network that is implemented by dRuby.}
14
14
  s.email = %q{d@ytak.info}
15
- s.executables = ["drbqs-execute", "drbqs-manage", "drbqs-node", "drbqs-server", "drbqs-ssh"]
15
+ s.executables = [%q{drbqs-execute}, %q{drbqs-manage}, %q{drbqs-node}, %q{drbqs-server}, %q{drbqs-ssh}]
16
16
  s.extra_rdoc_files = [
17
17
  "LICENSE.txt",
18
18
  "README.md"
@@ -30,6 +30,8 @@ Gem::Specification.new do |s|
30
30
  "bin/drbqs-node",
31
31
  "bin/drbqs-server",
32
32
  "bin/drbqs-ssh",
33
+ "docs/FormatExecute.md",
34
+ "docs/GettingStarted.md",
33
35
  "drbqs.gemspec",
34
36
  "example/README.md",
35
37
  "example/command/server_def.rb",
@@ -37,7 +39,18 @@ Gem::Specification.new do |s|
37
39
  "example/error_server/server_def.rb",
38
40
  "example/error_task/error.rb",
39
41
  "example/error_task/server_def.rb",
42
+ "example/execute/execute.rb",
43
+ "example/execute/server.rb",
44
+ "example/execute/task.rb",
45
+ "example/mandelbrot/README.md",
46
+ "example/mandelbrot/execute.rb",
47
+ "example/mandelbrot/mandelbrot.rb",
48
+ "example/mandelbrot/server.rb",
40
49
  "example/server/server.rb",
50
+ "example/simple/README.md",
51
+ "example/simple/execute.rb",
52
+ "example/simple/server.rb",
53
+ "example/simple/task.rb",
41
54
  "example/sum/server_def.rb",
42
55
  "example/sum/sum.rb",
43
56
  "example/sum2/execute_def.rb",
@@ -58,10 +71,12 @@ Gem::Specification.new do |s|
58
71
  "lib/drbqs/config/config.rb",
59
72
  "lib/drbqs/config/process_list.rb",
60
73
  "lib/drbqs/config/ssh_host.rb",
74
+ "lib/drbqs/execute/execute_node.rb",
61
75
  "lib/drbqs/execute/process_define.rb",
62
76
  "lib/drbqs/execute/register.rb",
63
77
  "lib/drbqs/execute/server_define.rb",
64
- "lib/drbqs/manage/execute_node.rb",
78
+ "lib/drbqs/ext/task.rb",
79
+ "lib/drbqs/ext/task/command_task.rb",
65
80
  "lib/drbqs/manage/manage.rb",
66
81
  "lib/drbqs/manage/send_signal.rb",
67
82
  "lib/drbqs/manage/ssh_execute.rb",
@@ -75,11 +90,11 @@ Gem::Specification.new do |s|
75
90
  "lib/drbqs/server/history.rb",
76
91
  "lib/drbqs/server/message.rb",
77
92
  "lib/drbqs/server/node_list.rb",
78
- "lib/drbqs/server/prof.rb",
79
93
  "lib/drbqs/server/queue.rb",
80
94
  "lib/drbqs/server/server.rb",
81
95
  "lib/drbqs/server/server_hook.rb",
82
96
  "lib/drbqs/server/test/node.rb",
97
+ "lib/drbqs/server/test/prof.rb",
83
98
  "lib/drbqs/server/test/server.rb",
84
99
  "lib/drbqs/server/transfer_setting.rb",
85
100
  "lib/drbqs/setting/base.rb",
@@ -91,13 +106,15 @@ Gem::Specification.new do |s|
91
106
  "lib/drbqs/setting/setting.rb",
92
107
  "lib/drbqs/setting/source.rb",
93
108
  "lib/drbqs/setting/ssh.rb",
94
- "lib/drbqs/task/command_task.rb",
109
+ "lib/drbqs/task/registrar.rb",
95
110
  "lib/drbqs/task/task.rb",
96
111
  "lib/drbqs/task/task_generator.rb",
97
112
  "lib/drbqs/utility/misc.rb",
98
113
  "lib/drbqs/utility/temporary.rb",
99
- "lib/drbqs/utility/transfer/file_transfer.rb",
114
+ "lib/drbqs/utility/transfer/transfer.rb",
100
115
  "lib/drbqs/utility/transfer/transfer_client.rb",
116
+ "lib/drbqs/utility/transfer/transfer_client_connect.rb",
117
+ "lib/drbqs/utility/transfer/transfer_file_list.rb",
101
118
  "spec/command_line/command_base_spec.rb",
102
119
  "spec/command_line/commands_spec.rb",
103
120
  "spec/command_line/option_setting_spec.rb",
@@ -105,10 +122,12 @@ Gem::Specification.new do |s|
105
122
  "spec/config/process_list_spec.rb",
106
123
  "spec/config/ssh_host_spec.rb",
107
124
  "spec/execute/def/execute1.rb",
125
+ "spec/execute/def/execute2.rb",
108
126
  "spec/execute/def/no_def.rb",
109
127
  "spec/execute/process_define_spec.rb",
110
128
  "spec/execute/register_spec.rb",
111
129
  "spec/execute/server_define_spec.rb",
130
+ "spec/ext/task/command_task_spec.rb",
112
131
  "spec/integration_test/01_basic_usage_spec.rb",
113
132
  "spec/integration_test/02_use_generator_spec.rb",
114
133
  "spec/integration_test/03_use_temporary_file_spec.rb",
@@ -126,6 +145,7 @@ Gem::Specification.new do |s|
126
145
  "spec/manage/send_signal_spec.rb",
127
146
  "spec/manage/ssh_shell_spec.rb",
128
147
  "spec/node/connection_spec.rb",
148
+ "spec/node/node_spec.rb",
129
149
  "spec/node/state_spec.rb",
130
150
  "spec/node/task_client_spec.rb",
131
151
  "spec/server/acl_file_spec.rb",
@@ -146,17 +166,20 @@ Gem::Specification.new do |s|
146
166
  "spec/setting/server_spec.rb",
147
167
  "spec/setting/source_spec.rb",
148
168
  "spec/spec_helper.rb",
149
- "spec/task/file_transfer_spec.rb",
169
+ "spec/task/registrar_spec.rb",
150
170
  "spec/task/task_generator_spec.rb",
151
171
  "spec/task/task_spec.rb",
152
172
  "spec/utility/argument_spec.rb",
153
173
  "spec/utility/misc_spec.rb",
154
- "spec/utility/temporary_spec.rb"
174
+ "spec/utility/temporary_spec.rb",
175
+ "spec/utility/transfer/transfer_client_connect_spec.rb",
176
+ "spec/utility/transfer/transfer_file_list_spec.rb",
177
+ "spec/utility/transfer/transfer_spec.rb"
155
178
  ]
156
179
  s.homepage = %q{http://github.com/ytaka/drbqs}
157
- s.licenses = ["GPL3"]
158
- s.require_paths = ["lib"]
159
- s.rubygems_version = %q{1.6.2}
180
+ s.licenses = [%q{GPL3}]
181
+ s.require_paths = [%q{lib}]
182
+ s.rubygems_version = %q{1.8.5}
160
183
  s.summary = %q{dRuby Queueing System}
161
184
 
162
185
  if s.respond_to? :specification_version then
@@ -3,12 +3,11 @@
3
3
  # drbqs-server server_def.rb
4
4
  #
5
5
 
6
- DRbQS.define_server(:finish_exit => true) do |server, argv, opts|
7
- tgen = DRbQS::TaskGenerator.new(:sleep_time => 2)
8
- tgen.set do
6
+ DRbQS.define_server do |server, argv, opts|
7
+ sleep_time = 2
8
+ server.task_generator do |reg|
9
9
  3.times do |i|
10
- add_task(DRbQS::CommandTask.new(["sleep #{@sleep_time}", 'echo hello world']))
10
+ reg.add(DRbQS::CommandTask.new(["sleep #{sleep_time}", 'echo hello world']))
11
11
  end
12
12
  end
13
- server.add_task_generator(tgen)
14
13
  end
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env drbqs-execute
2
+ # -*-ruby-*-
3
+
4
+ usage message: "Message of this file", server: File.join(File.dirname(__FILE__), 'server.rb'), log: "/tmp/drbqs/log"
5
+
6
+ default server: :server1, port: 12345, node: [:node1, :node3, :node5]
7
+
8
+ ssh_directory = "/ssh/path/to"
9
+
10
+ server :server1, 'example.com' do |server, ssh|
11
+ ssh.directory ssh_directory
12
+ ssh.output "/path/to/log"
13
+ ssh.nice 5
14
+ server.load "server.rb"
15
+ server.log_level 'error'
16
+ end
17
+
18
+ server :local, 'localhost' do |server|
19
+ server.load "server.rb"
20
+ server.log_level 'error'
21
+ end
22
+
23
+ node :node_base, template: true do |node, ssh|
24
+ ssh.directory ssh_directory
25
+ ssh.output "/path/to/node_ssh"
26
+ ssh.nice 10
27
+ node.process 2
28
+ node.load "server.rb"
29
+ node.log_level 'error'
30
+ end
31
+
32
+ ssh_user = 'user_name'
33
+ [1, 2, 3, 4, 5, 6].each do |n|
34
+ name = "node%02d" % n
35
+ node name, load: :node_base do |node, ssh|
36
+ ssh.connect "#{ssh_user}@#{name}.example.com"
37
+ end
38
+ end
39
+
40
+ node :even, group: [:node02, :node04, :node06]
41
+ node :odd, group: [:node01, :node03, :node05]
@@ -0,0 +1,14 @@
1
+ require_relative 'task.rb'
2
+
3
+ DRbQS.option_parser("Usage of server") do |prs, opts|
4
+ prs.on('-s STR', '--string STR', String, "Set string.") do |v|
5
+ opts[:string] = v
6
+ end
7
+ prs.on('-n NUM', '--number NUM', Integer, "Set number.") do |v|
8
+ opts[:number] = v
9
+ end
10
+ end
11
+
12
+ DRbQS.define_server(finish_exit: true) do |server, argv, opts|
13
+
14
+ end