drbqs 0.0.16 → 0.0.17

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,45 @@
1
+ # rcov generated
2
+ coverage
3
+
4
+ # rdoc generated
5
+ rdoc
6
+
7
+ # yard generated
8
+ doc
9
+ .yardoc
10
+
11
+ # bundler
12
+ .bundle
13
+
14
+ # jeweler generated
15
+ pkg
16
+
17
+ # Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
18
+ #
19
+ # * Create a file at ~/.gitignore
20
+ # * Include files you want ignored
21
+ # * Run: git config --global core.excludesfile ~/.gitignore
22
+ #
23
+ # After doing this, these files will be ignored in all your git projects,
24
+ # saving you from having to 'pollute' every project you touch with them
25
+ #
26
+ # Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
27
+ #
28
+ # For MacOS:
29
+ #
30
+ #.DS_Store
31
+ #
32
+ # For TextMate
33
+ #*.tmproj
34
+ #tmtags
35
+ #
36
+ # For emacs:
37
+ *~
38
+ \#*
39
+ .\#*
40
+
41
+ # For vim:
42
+ #*.swp
43
+
44
+ Gemfile.lock
45
+ spec/home_for_spec
File without changes
data/Gemfile CHANGED
@@ -1,20 +1,4 @@
1
1
  source "http://rubygems.org"
2
- # Add dependencies required to use your gem here.
3
- # Example:
4
- # gem "activesupport", ">= 2.3.5"
5
2
 
6
- # Add dependencies to develop your gem here.
7
- # Include everything needed to run rake, tests, features, etc.
8
- group :development do
9
- gem "rspec", ">= 2.6.0"
10
- gem "yard", ">= 0.7.2"
11
- gem "bundler", ">= 1.0.15"
12
- gem "jeweler", ">= 1.6.2"
13
- gem "rcov", ">= 0"
14
- gem "filename", ">= 0.1.0"
15
- gem "user_config", ">= 0.0.1"
16
- gem "net-ssh", ">= 2.1.4"
17
- gem "net-ssh-shell", ">= 0.2.0"
18
- gem "net-sftp", ">= 2.0.5"
19
- gem "sys-proctable"
20
- end
3
+ # Specify your gem's dependencies in drbqs.gemspec
4
+ gemspec
data/Rakefile CHANGED
@@ -1,34 +1,4 @@
1
- require 'rubygems'
2
- require 'bundler'
3
- begin
4
- Bundler.setup(:default, :development)
5
- rescue Bundler::BundlerError => e
6
- $stderr.puts e.message
7
- $stderr.puts "Run `bundle install` to install missing gems"
8
- exit e.status_code
9
- end
10
- require 'rake'
11
-
12
- require 'jeweler'
13
- Jeweler::Tasks.new do |gem|
14
- # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
15
- gem.name = "drbqs"
16
- gem.homepage = "http://github.com/ytaka/drbqs"
17
- gem.license = "GPL3"
18
- gem.summary = "dRuby Queueing System"
19
- gem.description = "Task queuing system over network that is implemented by dRuby."
20
- gem.email = "d@ytak.info"
21
- gem.authors = ["Takayuki YAMAGUCHI"]
22
- # Include your dependencies below. Runtime dependencies are required when using your gem,
23
- # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
24
- gem.add_runtime_dependency 'filename', '>= 0.1.0'
25
- gem.add_runtime_dependency "user_config", ">= 0.0.2"
26
- gem.add_runtime_dependency 'net-ssh', '>= 2.1.3'
27
- gem.add_runtime_dependency 'net-ssh-shell', '>= 0.1.0'
28
- gem.add_runtime_dependency "net-sftp", ">= 2.0.5"
29
- gem.add_runtime_dependency "sys-proctable"
30
- end
31
- Jeweler::RubygemsDotOrgTasks.new
1
+ require "bundler/gem_tasks"
32
2
 
33
3
  desc "Run all specs"
34
4
  task 'spec:all' => ['spec:unit', 'spec:integration']
@@ -57,17 +27,6 @@ task :default => 'spec:all'
57
27
  require 'yard'
58
28
  YARD::Rake::YardocTask.new
59
29
 
60
- desc "Update version of drbqs.rb"
61
- task "version:constant" do
62
- dir = File.dirname(__FILE__)
63
- path = File.join(dir, 'lib/drbqs.rb')
64
- data = File.read(path)
65
- version = File.read(File.join(dir, 'VERSION'))
66
- open(path, 'w') do |f|
67
- f.print data.sub(/^ VERSION = '.*'$/, " VERSION = '#{version}'")
68
- end
69
- end
70
-
71
30
  desc "Remove temporary home directory for specs."
72
31
  task "clean:temporary" do
73
32
  dir = File.join(File.dirname(__FILE__), 'spec', 'home_for_spec')
@@ -1,245 +1,30 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
1
  # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "drbqs/version"
5
4
 
6
5
  Gem::Specification.new do |s|
7
- s.name = %q{drbqs}
8
- s.version = "0.0.16"
6
+ s.name = "drbqs"
7
+ s.version = DRbQS::VERSION
8
+ s.authors = ["Takayuki YAMAGUCHI"]
9
+ s.email = ["d@ytak.info"]
10
+ s.homepage = ""
11
+ s.summary = "dRuby Queueing System"
12
+ s.description = "Task queuing system over network that is implemented by dRuby."
9
13
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = [%q{Takayuki YAMAGUCHI}]
12
- s.date = %q{2011-08-03}
13
- s.description = %q{Task queuing system over network that is implemented by dRuby.}
14
- s.email = %q{d@ytak.info}
15
- s.executables = [%q{drbqs-execute}, %q{drbqs-manage}, %q{drbqs-node}, %q{drbqs-server}, %q{drbqs-ssh}]
16
- s.extra_rdoc_files = [
17
- "LICENSE.txt",
18
- "README.md"
19
- ]
20
- s.files = [
21
- ".document",
22
- ".rspec",
23
- "Gemfile",
24
- "LICENSE.txt",
25
- "README.md",
26
- "Rakefile",
27
- "VERSION",
28
- "bin/drbqs-execute",
29
- "bin/drbqs-manage",
30
- "bin/drbqs-node",
31
- "bin/drbqs-server",
32
- "bin/drbqs-ssh",
33
- "docs/FormatExecute.md",
34
- "docs/GettingStarted.md",
35
- "drbqs.gemspec",
36
- "example/README.md",
37
- "example/command/server_def.rb",
38
- "example/error_server/error.rb",
39
- "example/error_server/server_def.rb",
40
- "example/error_task/error.rb",
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",
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",
54
- "example/sum/server_def.rb",
55
- "example/sum/sum.rb",
56
- "example/sum2/execute_def.rb",
57
- "example/sum2/server_def.rb",
58
- "example/sum2/sum.rb",
59
- "example/transfer/file.rb",
60
- "example/transfer/server_def.rb",
61
- "lib/drbqs.rb",
62
- "lib/drbqs/command_line/argument.rb",
63
- "lib/drbqs/command_line/command_base.rb",
64
- "lib/drbqs/command_line/command_execute.rb",
65
- "lib/drbqs/command_line/command_line.rb",
66
- "lib/drbqs/command_line/command_manage.rb",
67
- "lib/drbqs/command_line/command_node.rb",
68
- "lib/drbqs/command_line/command_server.rb",
69
- "lib/drbqs/command_line/command_ssh.rb",
70
- "lib/drbqs/command_line/option_setting.rb",
71
- "lib/drbqs/config/config.rb",
72
- "lib/drbqs/config/process_list.rb",
73
- "lib/drbqs/config/ssh_host.rb",
74
- "lib/drbqs/execute/execute_node.rb",
75
- "lib/drbqs/execute/process_define.rb",
76
- "lib/drbqs/execute/register.rb",
77
- "lib/drbqs/execute/server_define.rb",
78
- "lib/drbqs/ext/task.rb",
79
- "lib/drbqs/ext/task/command_task.rb",
80
- "lib/drbqs/manage/manage.rb",
81
- "lib/drbqs/manage/send_signal.rb",
82
- "lib/drbqs/manage/ssh_execute.rb",
83
- "lib/drbqs/manage/ssh_shell.rb",
84
- "lib/drbqs/node/connection.rb",
85
- "lib/drbqs/node/node.rb",
86
- "lib/drbqs/node/state.rb",
87
- "lib/drbqs/node/task_client.rb",
88
- "lib/drbqs/server/acl_file.rb",
89
- "lib/drbqs/server/check_alive.rb",
90
- "lib/drbqs/server/history.rb",
91
- "lib/drbqs/server/message.rb",
92
- "lib/drbqs/server/node_list.rb",
93
- "lib/drbqs/server/queue.rb",
94
- "lib/drbqs/server/server.rb",
95
- "lib/drbqs/server/server_hook.rb",
96
- "lib/drbqs/server/test/node.rb",
97
- "lib/drbqs/server/test/prof.rb",
98
- "lib/drbqs/server/test/server.rb",
99
- "lib/drbqs/server/transfer_setting.rb",
100
- "lib/drbqs/setting/base.rb",
101
- "lib/drbqs/setting/data_container.rb",
102
- "lib/drbqs/setting/execute.rb",
103
- "lib/drbqs/setting/manage.rb",
104
- "lib/drbqs/setting/node.rb",
105
- "lib/drbqs/setting/server.rb",
106
- "lib/drbqs/setting/setting.rb",
107
- "lib/drbqs/setting/source.rb",
108
- "lib/drbqs/setting/ssh.rb",
109
- "lib/drbqs/task/registrar.rb",
110
- "lib/drbqs/task/task.rb",
111
- "lib/drbqs/task/task_generator.rb",
112
- "lib/drbqs/utility/misc.rb",
113
- "lib/drbqs/utility/temporary.rb",
114
- "lib/drbqs/utility/transfer/transfer.rb",
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",
118
- "spec/command_line/command_base_spec.rb",
119
- "spec/command_line/commands_spec.rb",
120
- "spec/command_line/option_setting_spec.rb",
121
- "spec/config/config_spec.rb",
122
- "spec/config/process_list_spec.rb",
123
- "spec/config/ssh_host_spec.rb",
124
- "spec/execute/def/execute1.rb",
125
- "spec/execute/def/execute2.rb",
126
- "spec/execute/def/no_def.rb",
127
- "spec/execute/process_define_spec.rb",
128
- "spec/execute/register_spec.rb",
129
- "spec/execute/server_define_spec.rb",
130
- "spec/ext/task/command_task_spec.rb",
131
- "spec/integration_test/01_basic_usage_spec.rb",
132
- "spec/integration_test/02_use_generator_spec.rb",
133
- "spec/integration_test/03_use_temporary_file_spec.rb",
134
- "spec/integration_test/04_use_unix_domain_spec.rb",
135
- "spec/integration_test/05_server_exit_signal_spec.rb",
136
- "spec/integration_test/06_node_exit_after_task_spec.rb",
137
- "spec/integration_test/07_command_server_with_node_spec.rb",
138
- "spec/integration_test/08_shutdown_unused_nodes_spec.rb",
139
- "spec/integration_test/09_server_process_data_spec.rb",
140
- "spec/integration_test/10_test_server_spec.rb",
141
- "spec/integration_test/definition/server01.rb",
142
- "spec/integration_test/definition/server02.rb",
143
- "spec/integration_test/definition/task_obj_definition.rb",
144
- "spec/manage/manage_spec.rb",
145
- "spec/manage/send_signal_spec.rb",
146
- "spec/manage/ssh_shell_spec.rb",
147
- "spec/node/connection_spec.rb",
148
- "spec/node/node_spec.rb",
149
- "spec/node/state_spec.rb",
150
- "spec/node/task_client_spec.rb",
151
- "spec/server/acl_file_spec.rb",
152
- "spec/server/check_alive_spec.rb",
153
- "spec/server/data/acl.txt",
154
- "spec/server/history_spec.rb",
155
- "spec/server/message_spec.rb",
156
- "spec/server/node_list_spec.rb",
157
- "spec/server/queue_spec.rb",
158
- "spec/server/server_hook_spec.rb",
159
- "spec/server/server_spec.rb",
160
- "spec/server/transfer_setting_spec.rb",
161
- "spec/setting/base_spec.rb",
162
- "spec/setting/data_container_spec.rb",
163
- "spec/setting/execute_spec.rb",
164
- "spec/setting/manage_spec.rb",
165
- "spec/setting/node_spec.rb",
166
- "spec/setting/server_spec.rb",
167
- "spec/setting/source_spec.rb",
168
- "spec/spec_helper.rb",
169
- "spec/task/registrar_spec.rb",
170
- "spec/task/task_generator_spec.rb",
171
- "spec/task/task_spec.rb",
172
- "spec/utility/argument_spec.rb",
173
- "spec/utility/misc_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"
178
- ]
179
- s.homepage = %q{http://github.com/ytaka/drbqs}
180
- s.licenses = [%q{GPL3}]
181
- s.require_paths = [%q{lib}]
182
- s.rubygems_version = %q{1.8.5}
183
- s.summary = %q{dRuby Queueing System}
14
+ s.rubyforge_project = "drbqs"
184
15
 
185
- if s.respond_to? :specification_version then
186
- s.specification_version = 3
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
187
20
 
188
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
189
- s.add_development_dependency(%q<rspec>, [">= 2.6.0"])
190
- s.add_development_dependency(%q<yard>, [">= 0.7.2"])
191
- s.add_development_dependency(%q<bundler>, [">= 1.0.15"])
192
- s.add_development_dependency(%q<jeweler>, [">= 1.6.2"])
193
- s.add_development_dependency(%q<rcov>, [">= 0"])
194
- s.add_development_dependency(%q<filename>, [">= 0.1.0"])
195
- s.add_development_dependency(%q<user_config>, [">= 0.0.1"])
196
- s.add_development_dependency(%q<net-ssh>, [">= 2.1.4"])
197
- s.add_development_dependency(%q<net-ssh-shell>, [">= 0.2.0"])
198
- s.add_development_dependency(%q<net-sftp>, [">= 2.0.5"])
199
- s.add_development_dependency(%q<sys-proctable>, [">= 0"])
200
- s.add_runtime_dependency(%q<filename>, [">= 0.1.0"])
201
- s.add_runtime_dependency(%q<user_config>, [">= 0.0.2"])
202
- s.add_runtime_dependency(%q<net-ssh>, [">= 2.1.3"])
203
- s.add_runtime_dependency(%q<net-ssh-shell>, [">= 0.1.0"])
204
- s.add_runtime_dependency(%q<net-sftp>, [">= 2.0.5"])
205
- s.add_runtime_dependency(%q<sys-proctable>, [">= 0"])
206
- else
207
- s.add_dependency(%q<rspec>, [">= 2.6.0"])
208
- s.add_dependency(%q<yard>, [">= 0.7.2"])
209
- s.add_dependency(%q<bundler>, [">= 1.0.15"])
210
- s.add_dependency(%q<jeweler>, [">= 1.6.2"])
211
- s.add_dependency(%q<rcov>, [">= 0"])
212
- s.add_dependency(%q<filename>, [">= 0.1.0"])
213
- s.add_dependency(%q<user_config>, [">= 0.0.1"])
214
- s.add_dependency(%q<net-ssh>, [">= 2.1.4"])
215
- s.add_dependency(%q<net-ssh-shell>, [">= 0.2.0"])
216
- s.add_dependency(%q<net-sftp>, [">= 2.0.5"])
217
- s.add_dependency(%q<sys-proctable>, [">= 0"])
218
- s.add_dependency(%q<filename>, [">= 0.1.0"])
219
- s.add_dependency(%q<user_config>, [">= 0.0.2"])
220
- s.add_dependency(%q<net-ssh>, [">= 2.1.3"])
221
- s.add_dependency(%q<net-ssh-shell>, [">= 0.1.0"])
222
- s.add_dependency(%q<net-sftp>, [">= 2.0.5"])
223
- s.add_dependency(%q<sys-proctable>, [">= 0"])
224
- end
225
- else
226
- s.add_dependency(%q<rspec>, [">= 2.6.0"])
227
- s.add_dependency(%q<yard>, [">= 0.7.2"])
228
- s.add_dependency(%q<bundler>, [">= 1.0.15"])
229
- s.add_dependency(%q<jeweler>, [">= 1.6.2"])
230
- s.add_dependency(%q<rcov>, [">= 0"])
231
- s.add_dependency(%q<filename>, [">= 0.1.0"])
232
- s.add_dependency(%q<user_config>, [">= 0.0.1"])
233
- s.add_dependency(%q<net-ssh>, [">= 2.1.4"])
234
- s.add_dependency(%q<net-ssh-shell>, [">= 0.2.0"])
235
- s.add_dependency(%q<net-sftp>, [">= 2.0.5"])
236
- s.add_dependency(%q<sys-proctable>, [">= 0"])
237
- s.add_dependency(%q<filename>, [">= 0.1.0"])
238
- s.add_dependency(%q<user_config>, [">= 0.0.2"])
239
- s.add_dependency(%q<net-ssh>, [">= 2.1.3"])
240
- s.add_dependency(%q<net-ssh-shell>, [">= 0.1.0"])
241
- s.add_dependency(%q<net-sftp>, [">= 2.0.5"])
242
- s.add_dependency(%q<sys-proctable>, [">= 0"])
243
- end
21
+ # specify any dependencies here; for example:
22
+ s.add_development_dependency "rspec", ">= 2.6.0"
23
+ s.add_development_dependency "yard", ">= 0.7.2"
24
+ s.add_runtime_dependency 'filename', '>= 0.1.0'
25
+ s.add_runtime_dependency "user_config", ">= 0.0.2"
26
+ s.add_runtime_dependency 'net-ssh', '>= 2.1.0'
27
+ s.add_runtime_dependency 'net-ssh-shell', '>= 0.2.0'
28
+ s.add_runtime_dependency "net-sftp", ">= 2.0.5"
29
+ s.add_runtime_dependency "sys-proctable"
244
30
  end
245
-
@@ -9,6 +9,7 @@ require 'fileutils'
9
9
 
10
10
  require 'filename'
11
11
 
12
+ require 'drbqs/version'
12
13
  require 'drbqs/execute/server_define'
13
14
  require 'drbqs/utility/misc'
14
15
 
@@ -19,6 +20,4 @@ module DRbQS
19
20
  autoload :Setting, 'drbqs/setting/setting'
20
21
 
21
22
  ROOT_DEFAULT_PORT = 13500
22
-
23
- VERSION = '0.0.16'
24
23
  end
@@ -17,6 +17,8 @@ module DRbQS
17
17
 
18
18
  # If +file+ exists then this method returns false.
19
19
  # Otherwise, return true.
20
+ # @param [String] file Set path under the data directory.
21
+ # @param [Object] data Set the save data that is converted to YAML.
20
22
  def save_file(file, data)
21
23
  path = path_under_directory(file)
22
24
  if File.exist?(path)
@@ -28,7 +28,7 @@ module DRbQS
28
28
  name.size > 0 && find_file(name)
29
29
  end
30
30
 
31
- # +name+ is file name without extension.
31
+ # @param [String] name File name without extension.
32
32
  def get_options(name)
33
33
  if path = get_path(name)
34
34
  return [path, YAML.load_file(path)]
@@ -91,7 +91,7 @@ module DRbQS
91
91
  #
92
92
  # @param [Symbol,String] name Server name
93
93
  # @param [Hash] opts The options of server
94
- # @option opts [true,false] :template Template for other servers to load, not actual server
94
+ # @option opts [Boolean] :template Template for other servers to load, not actual server
95
95
  # @option opts [Symbol] :load Inherit definition of other server
96
96
  #
97
97
  # @example A server on localhost
@@ -173,9 +173,9 @@ module DRbQS
173
173
  #
174
174
  # @param [Symbol,String] name Node name
175
175
  # @param [Hash] opts The options of node
176
- # @option opts [true,false] :template Template for other nodes to load, not actual node
176
+ # @option opts [Boolean] :template Template for other nodes to load, not actual node
177
177
  # @option opts [Symbol] :load Inherit definition of other node
178
- # @option opts [true,false] :group Define the group of node
178
+ # @option opts [Boolean] :group Define the group of node
179
179
  #
180
180
  # @example Nodes on localhost
181
181
  # node :node_local do |nd|
@@ -4,17 +4,19 @@ require 'net/ssh/shell'
4
4
  module DRbQS
5
5
  class Manage
6
6
  # Requirements:
7
- # bash
7
+ #
8
+ # * bash
8
9
  class SSHShell
9
10
  class RubyEnvironment
10
11
  DEFAULT_RVM_SCRIPT = '$HOME/.rvm/scripts/rvm'
11
12
 
12
13
  attr_reader :directory, :rvm, :rvm_init, :env
13
14
 
14
- # :directory
15
- # :rvm
16
- # :rvm_init
17
- # :env
15
+ # @param [Hash] opts The options of ruby environment.
16
+ # @option opts [String] :directory Directory when we execute commands.
17
+ # @option opts [String] :rvm Set ruby implementation on rvm.
18
+ # @option opts [String] :rvm_init Set the path of init script of rvm.
19
+ # @option opts [Hash] :env Set pair of environmental variables and their values.
18
20
  def initialize(opts = {})
19
21
  @directory = opts[:directory]
20
22
  @rvm = opts[:rvm]
@@ -54,20 +56,24 @@ module DRbQS
54
56
 
55
57
  attr_reader :user, :host, :port, :keys
56
58
 
57
- # :shell shell to use
58
- # :env a hash of environmental variables and their values
59
- # :dir base directory of ssh server
60
- # :rvm version of ruby on rvm
61
- # :rvm_init path of script to initialize rvm
62
- # :keys path of a ssh key
63
- # :io IO to output results of commands
59
+ DEFAULT_SHELL = 'bash'
60
+
61
+ # @param [String] dest Destination of SSH.
62
+ # @param [Hash] opts The options of SSH shell.
63
+ # @option opts [String] :shell The shell to use.
64
+ # @option opts [String] :keys Path of a ssh key.
65
+ # @option opts [IO] :io IO to output results of commands.
66
+ # @option opts [Hash] :env Same as options DRbQS::Manage::SSHShell::RubyEnvironment.
67
+ # @option opts [String] :directory Same as options DRbQS::Manage::SSHShell::RubyEnvironment.
68
+ # @option opts [String] :rvm Same as options DRbQS::Manage::SSHShell::RubyEnvironment.
69
+ # @option opts [String] :rvm_init Same as options DRbQS::Manage::SSHShell::RubyEnvironment.
64
70
  def initialize(dest, opts = {})
65
71
  @user, @host, @port = split_destination(dest)
66
72
  if !(@host && @user)
67
73
  raise ArgumentError, "Invalid ssh server: host=#{@host.inspect}, user=#{@user.inspect}."
68
74
  end
69
75
  @keys = opts.delete(:keys)
70
- @shell = opts[:shell] || 'bash'
76
+ @shell = opts.delete(:shell) || DEFAULT_SHELL
71
77
  @ruby_environment = DRbQS::Manage::SSHShell::RubyEnvironment.new(opts)
72
78
  @out = opts[:io]
73
79
  @ssh = nil
@@ -163,7 +169,9 @@ module DRbQS
163
169
  @ssh = nil
164
170
  end
165
171
 
166
- # :check
172
+ # @param [Array] commands An array of list of commands.
173
+ # @param [Hash] opts Options
174
+ # @option opts [Boolean] :check Check exit codes of commands.
167
175
  def execute_all(commands, opts = {})
168
176
  results = []
169
177
  start do |ssh_shell|
@@ -1,7 +1,7 @@
1
1
  module DRbQS
2
2
  class Node
3
- # Value of state is :sleep, :wait, or :calculate.
4
3
  class State
4
+ # Value of state is :sleep, :wait, or :calculate.
5
5
  attr_reader :state
6
6
 
7
7
  ALL_STATES = [:sleep, :wait, :calculate]
@@ -3,10 +3,10 @@ module DRbQS
3
3
  module ACLFile
4
4
 
5
5
  # Create ACL object from file.
6
- # The example of file is the following:
7
- # deny all
8
- # allow localhost
9
- # allow 127.0.0.1
6
+ # @example Deny hosts except for localhost
7
+ # deny all
8
+ # allow localhost
9
+ # allow 127.0.0.1
10
10
  def self.load(path)
11
11
  ACL.new(File.read(path).split)
12
12
  end
@@ -11,14 +11,17 @@ module DRbQS
11
11
  @logger = logger
12
12
  end
13
13
 
14
- # Returned values:
15
- # [:exit_server, nil]
16
- # [:request_status, nil]
17
- # [:request_history, nil]
18
- # [:exit_after_task, node_id]
19
- # [:wake_node, node_id]
20
- # [:sleep_node, node_id]
21
- # [:node_error, [node_id, error_message]]
14
+ # One of the following messages is returned.
15
+ #
16
+ # * [:exit_server, nil]
17
+ # * [:request_status, nil]
18
+ # * [:request_history, nil]
19
+ # * [:exit_after_task, node_id]
20
+ # * [:wake_node, node_id]
21
+ # * [:sleep_node, node_id]
22
+ # * [:node_error, [node_id, error_message]]
23
+ #
24
+ # @return [Array] Message array
22
25
  def get_message
23
26
  begin
24
27
  mes = @message.take([:server, Symbol, nil], 0)
@@ -21,8 +21,7 @@ module DRbQS
21
21
  end
22
22
  private :queue_task
23
23
 
24
- # &hook take two arguments: a DRbQS::Server::Queue object and a result of task.
25
- # Return task ID (for debug).
24
+ # @return [Fixnum] task ID (for debug)
26
25
  def add(task)
27
26
  @task_id += 1
28
27
  @logger.info("New task: #{@task_id}")
@@ -30,7 +30,7 @@ module DRbQS
30
30
  end
31
31
  end
32
32
  rescue Exception => err
33
- $stdout.puts "*** Error occurs in calculation roop ***"
33
+ $stdout.puts "*** Error occurs in calculation loop ***"
34
34
  b = err.backtrace
35
35
  $stdout.puts "#{b[0]}: #{err.to_s} (#{err.class})"
36
36
  $stdout.puts b[1..-1].join("\n") if b.size > 1
@@ -14,7 +14,10 @@ module DRbQS
14
14
 
15
15
  attr_reader :source
16
16
 
17
- # The keys of options are :all_keys_defined, :log_level, and :daemon
17
+ # The keys of options are
18
+ # @option opts [Boolean] :all_keys_defined Check existences of keys on setting values.
19
+ # @option opts [Boolean] :log_level Use the option of log level.
20
+ # @option opts [Boolean] :daemon Use the option of daemon.
18
21
  def initialize(opts = {}, &block)
19
22
  @source = DRbQS::Setting::Source.new(opts[:all_keys_defined])
20
23
  @source.register_key(:debug, :bool => true)
@@ -103,7 +103,7 @@ module DRbQS
103
103
  end
104
104
  private :command_status
105
105
 
106
- def command_history
106
+ def command_history(io)
107
107
  request_to_server(io, :get_history)
108
108
  end
109
109
  private :command_history
@@ -100,10 +100,11 @@ module DRbQS
100
100
  end
101
101
  private :parse_condition
102
102
 
103
- # :check
104
- # :add
105
- # :bool
106
- # :default
103
+ # @param [String,Symbol] key Set a key of a parameter value.
104
+ # @option opts [Array,Fixnum] :check Set the condition of value.
105
+ # @option opts [Boolean] :add The value is an array to set multiple values.
106
+ # @option opts [Boolean] :bool If opts[:bool] is true then the value is boolean.
107
+ # @option opts [Array] :default Set the default value.
107
108
  def register_key(key, opts = {})
108
109
  k = key.intern
109
110
  if registered_key?(k)
@@ -27,6 +27,7 @@ module DRbQS
27
27
  # @option opts [Symbol] :hook Method name for hook
28
28
  # that takes two arguments server and the result object.
29
29
  # @param [Proc] hook A server execute hook as a callback when the server receive the result
30
+ # hook take two arguments: a DRbQS::Server object and a result of task.
30
31
  # @note Changes of obj on a node are not sent to a server.
31
32
  # That is, opts[:hook] must not depend on changes of instance variables on a node.
32
33
  def initialize(obj, method_name, opts = {}, &hook)
@@ -20,6 +20,7 @@ module DRbQS
20
20
  @wait
21
21
  end
22
22
 
23
+ # Specify how to generate tasks.
23
24
  # @param [Hash] opts The options of task generation
24
25
  # @option opts [Fixnum] :generate Set the number of tasks per one generation
25
26
  # @option opts [Fixnum] :collect The generator creates a task set consisting of opts[:collect] tasks.
@@ -37,7 +38,7 @@ module DRbQS
37
38
  begin
38
39
  @registrar.instance_eval(&block)
39
40
  rescue => err
40
- new_err = self.class.new("Error on generating tasks: #{err.to_s} (#{err.class})")
41
+ new_err = err.class.new("Error on generating tasks: #{err.to_s} (#{err.class})")
41
42
  new_err.set_backtrace(err.backtrace)
42
43
  raise new_err
43
44
  end
@@ -16,9 +16,10 @@ module DRbQS
16
16
  end
17
17
  end
18
18
 
19
- # :port
20
- # :host
21
- # :unix
19
+ # @param [Hash] opts The arguments of URI of server
20
+ # @option opts [Fixnum] :port Port number of a server
21
+ # @option opts [String] :host Hostname of a server
22
+ # @option opts [String] :unix Path for unix domain socket of a server
22
23
  def create_uri(opts = {})
23
24
  if opts[:port] || !opts[:unix]
24
25
  port = opts[:port] || ROOT_DEFAULT_PORT
@@ -73,6 +74,7 @@ module DRbQS
73
74
 
74
75
  # If process of +pid+ does not exist or its state is zombie then the method return false.
75
76
  # If +pid+ is invalid then the method also returns false.
77
+ # @param [Fixnum] pid PID of process
76
78
  def process_running_normally?(pid)
77
79
  Integer === pid && (ps_table = Sys::ProcTable.ps(pid)) && (ps_table.state != 'Z')
78
80
  end
@@ -9,7 +9,7 @@ module DRbQS
9
9
  def self.filename
10
10
  unless @@filename
11
11
  pid = Process.pid
12
- @@root = File.join(Dir.tmpdir, sprintf("drbqs_%d_%d", pid, rand(10000)))
12
+ @@root = File.join(Dir.tmpdir, sprintf("drbqs_%s_%d_%d", ENV['USER'], pid, rand(10000)))
13
13
  FileUtils.mkdir_p(@@root, :mode => 0700)
14
14
  @@filename = FileName.new(File.join(@@root, sprintf("temp_%d_%d", pid, rand(10000))))
15
15
  end
@@ -8,34 +8,38 @@ module DRbQS
8
8
  # Add path to queue of which files is going to be transfered to server.
9
9
  # @param [String] path The file path that we want to send to a server.
10
10
  # @param [Hash] opts The options for transfering a file.
11
- # @option opts [true,false] :compress Compress the file by gzip before transfering.
11
+ # @option opts [Boolean] :compress Compress the file by gzip before transfering.
12
12
  # @option opts [String] :rename Change basename to the specified name.
13
13
  def enqueue(path, opts = {})
14
- if opts[:rename]
15
- new_path = FileName.create(File.join(File.dirname(path), opts[:rename]), :directory => :parent)
16
- FileUtils.mv(path, new_path)
17
- path = new_path
18
- end
19
- if opts[:compress]
20
- if File.directory?(path)
21
- gz_path = "#{path.sub(/\/$/, '')}.tar.gz"
22
- cmd = "tar czf #{gz_path} -C #{File.dirname(path)} #{File.basename(path)} > /dev/null 2>&1"
23
- else
24
- gz_path = path + '.gz'
25
- cmd = "gzip --best #{path} > /dev/null 2>&1"
14
+ if File.exist?(path)
15
+ if opts[:rename]
16
+ new_path = FileName.create(File.join(File.dirname(path), opts[:rename]), :directory => :parent)
17
+ FileUtils.mv(path, new_path)
18
+ path = new_path
26
19
  end
27
- if File.exist?(gz_path)
28
- raise "File has already existed: #{gz_path}"
29
- elsif !system(cmd)
30
- raise "Can not compress: #{path}"
20
+ if opts[:compress]
21
+ if File.directory?(path)
22
+ gz_path = "#{path.sub(/\/$/, '')}.tar.gz"
23
+ cmd = "tar czf #{gz_path} -C #{File.dirname(path)} #{File.basename(path)} > /dev/null 2>&1"
24
+ else
25
+ gz_path = path + '.gz'
26
+ cmd = "gzip --best #{path} > /dev/null 2>&1"
27
+ end
28
+ if File.exist?(gz_path)
29
+ raise "File has already existed: #{gz_path}"
30
+ elsif !system(cmd)
31
+ raise "Can not compress: #{path}"
32
+ end
33
+ FileUtils.rm_r(path) if File.exist?(path)
34
+ path_to_send = gz_path
35
+ else
36
+ path_to_send = path
31
37
  end
32
- FileUtils.rm_r(path) if File.exist?(path)
33
- path_to_send = gz_path
38
+ @files.enq(path_to_send)
39
+ File.basename(path_to_send)
34
40
  else
35
- path_to_send = path
41
+ nil
36
42
  end
37
- @files.enq(path_to_send)
38
- File.basename(path_to_send)
39
43
  end
40
44
 
41
45
  def compress_enqueue(path)
@@ -0,0 +1,3 @@
1
+ module DRbQS
2
+ VERSION = '0.0.17'
3
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drbqs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.16
4
+ version: 0.0.17
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-08-03 00:00:00.000000000 Z
12
+ date: 2011-08-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &20439060 !ruby/object:Gem::Requirement
16
+ requirement: &18201460 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 2.6.0
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *20439060
24
+ version_requirements: *18201460
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: yard
27
- requirement: &20437420 !ruby/object:Gem::Requirement
27
+ requirement: &18200180 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,109 +32,10 @@ dependencies:
32
32
  version: 0.7.2
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *20437420
36
- - !ruby/object:Gem::Dependency
37
- name: bundler
38
- requirement: &20436000 !ruby/object:Gem::Requirement
39
- none: false
40
- requirements:
41
- - - ! '>='
42
- - !ruby/object:Gem::Version
43
- version: 1.0.15
44
- type: :development
45
- prerelease: false
46
- version_requirements: *20436000
47
- - !ruby/object:Gem::Dependency
48
- name: jeweler
49
- requirement: &20434800 !ruby/object:Gem::Requirement
50
- none: false
51
- requirements:
52
- - - ! '>='
53
- - !ruby/object:Gem::Version
54
- version: 1.6.2
55
- type: :development
56
- prerelease: false
57
- version_requirements: *20434800
58
- - !ruby/object:Gem::Dependency
59
- name: rcov
60
- requirement: &20460380 !ruby/object:Gem::Requirement
61
- none: false
62
- requirements:
63
- - - ! '>='
64
- - !ruby/object:Gem::Version
65
- version: '0'
66
- type: :development
67
- prerelease: false
68
- version_requirements: *20460380
69
- - !ruby/object:Gem::Dependency
70
- name: filename
71
- requirement: &20456860 !ruby/object:Gem::Requirement
72
- none: false
73
- requirements:
74
- - - ! '>='
75
- - !ruby/object:Gem::Version
76
- version: 0.1.0
77
- type: :development
78
- prerelease: false
79
- version_requirements: *20456860
80
- - !ruby/object:Gem::Dependency
81
- name: user_config
82
- requirement: &20455420 !ruby/object:Gem::Requirement
83
- none: false
84
- requirements:
85
- - - ! '>='
86
- - !ruby/object:Gem::Version
87
- version: 0.0.1
88
- type: :development
89
- prerelease: false
90
- version_requirements: *20455420
91
- - !ruby/object:Gem::Dependency
92
- name: net-ssh
93
- requirement: &20472680 !ruby/object:Gem::Requirement
94
- none: false
95
- requirements:
96
- - - ! '>='
97
- - !ruby/object:Gem::Version
98
- version: 2.1.4
99
- type: :development
100
- prerelease: false
101
- version_requirements: *20472680
102
- - !ruby/object:Gem::Dependency
103
- name: net-ssh-shell
104
- requirement: &20470220 !ruby/object:Gem::Requirement
105
- none: false
106
- requirements:
107
- - - ! '>='
108
- - !ruby/object:Gem::Version
109
- version: 0.2.0
110
- type: :development
111
- prerelease: false
112
- version_requirements: *20470220
113
- - !ruby/object:Gem::Dependency
114
- name: net-sftp
115
- requirement: &20466740 !ruby/object:Gem::Requirement
116
- none: false
117
- requirements:
118
- - - ! '>='
119
- - !ruby/object:Gem::Version
120
- version: 2.0.5
121
- type: :development
122
- prerelease: false
123
- version_requirements: *20466740
124
- - !ruby/object:Gem::Dependency
125
- name: sys-proctable
126
- requirement: &19983300 !ruby/object:Gem::Requirement
127
- none: false
128
- requirements:
129
- - - ! '>='
130
- - !ruby/object:Gem::Version
131
- version: '0'
132
- type: :development
133
- prerelease: false
134
- version_requirements: *19983300
35
+ version_requirements: *18200180
135
36
  - !ruby/object:Gem::Dependency
136
37
  name: filename
137
- requirement: &19981400 !ruby/object:Gem::Requirement
38
+ requirement: &18199300 !ruby/object:Gem::Requirement
138
39
  none: false
139
40
  requirements:
140
41
  - - ! '>='
@@ -142,10 +43,10 @@ dependencies:
142
43
  version: 0.1.0
143
44
  type: :runtime
144
45
  prerelease: false
145
- version_requirements: *19981400
46
+ version_requirements: *18199300
146
47
  - !ruby/object:Gem::Dependency
147
48
  name: user_config
148
- requirement: &19979460 !ruby/object:Gem::Requirement
49
+ requirement: &18216600 !ruby/object:Gem::Requirement
149
50
  none: false
150
51
  requirements:
151
52
  - - ! '>='
@@ -153,32 +54,32 @@ dependencies:
153
54
  version: 0.0.2
154
55
  type: :runtime
155
56
  prerelease: false
156
- version_requirements: *19979460
57
+ version_requirements: *18216600
157
58
  - !ruby/object:Gem::Dependency
158
59
  name: net-ssh
159
- requirement: &19976500 !ruby/object:Gem::Requirement
60
+ requirement: &18214620 !ruby/object:Gem::Requirement
160
61
  none: false
161
62
  requirements:
162
63
  - - ! '>='
163
64
  - !ruby/object:Gem::Version
164
- version: 2.1.3
65
+ version: 2.1.0
165
66
  type: :runtime
166
67
  prerelease: false
167
- version_requirements: *19976500
68
+ version_requirements: *18214620
168
69
  - !ruby/object:Gem::Dependency
169
70
  name: net-ssh-shell
170
- requirement: &20054800 !ruby/object:Gem::Requirement
71
+ requirement: &18213260 !ruby/object:Gem::Requirement
171
72
  none: false
172
73
  requirements:
173
74
  - - ! '>='
174
75
  - !ruby/object:Gem::Version
175
- version: 0.1.0
76
+ version: 0.2.0
176
77
  type: :runtime
177
78
  prerelease: false
178
- version_requirements: *20054800
79
+ version_requirements: *18213260
179
80
  - !ruby/object:Gem::Dependency
180
81
  name: net-sftp
181
- requirement: &20050920 !ruby/object:Gem::Requirement
82
+ requirement: &18212080 !ruby/object:Gem::Requirement
182
83
  none: false
183
84
  requirements:
184
85
  - - ! '>='
@@ -186,10 +87,10 @@ dependencies:
186
87
  version: 2.0.5
187
88
  type: :runtime
188
89
  prerelease: false
189
- version_requirements: *20050920
90
+ version_requirements: *18212080
190
91
  - !ruby/object:Gem::Dependency
191
92
  name: sys-proctable
192
- requirement: &20048980 !ruby/object:Gem::Requirement
93
+ requirement: &18210980 !ruby/object:Gem::Requirement
193
94
  none: false
194
95
  requirements:
195
96
  - - ! '>='
@@ -197,9 +98,10 @@ dependencies:
197
98
  version: '0'
198
99
  type: :runtime
199
100
  prerelease: false
200
- version_requirements: *20048980
101
+ version_requirements: *18210980
201
102
  description: Task queuing system over network that is implemented by dRuby.
202
- email: d@ytak.info
103
+ email:
104
+ - d@ytak.info
203
105
  executables:
204
106
  - drbqs-execute
205
107
  - drbqs-manage
@@ -207,17 +109,15 @@ executables:
207
109
  - drbqs-server
208
110
  - drbqs-ssh
209
111
  extensions: []
210
- extra_rdoc_files:
211
- - LICENSE.txt
212
- - README.md
112
+ extra_rdoc_files: []
213
113
  files:
214
- - .document
114
+ - .gitignore
215
115
  - .rspec
116
+ - .yardopts
216
117
  - Gemfile
217
118
  - LICENSE.txt
218
119
  - README.md
219
120
  - Rakefile
220
- - VERSION
221
121
  - bin/drbqs-execute
222
122
  - bin/drbqs-manage
223
123
  - bin/drbqs-node
@@ -308,6 +208,7 @@ files:
308
208
  - lib/drbqs/utility/transfer/transfer_client.rb
309
209
  - lib/drbqs/utility/transfer/transfer_client_connect.rb
310
210
  - lib/drbqs/utility/transfer/transfer_file_list.rb
211
+ - lib/drbqs/version.rb
311
212
  - spec/command_line/command_base_spec.rb
312
213
  - spec/command_line/commands_spec.rb
313
214
  - spec/command_line/option_setting_spec.rb
@@ -368,9 +269,8 @@ files:
368
269
  - spec/utility/transfer/transfer_client_connect_spec.rb
369
270
  - spec/utility/transfer/transfer_file_list_spec.rb
370
271
  - spec/utility/transfer/transfer_spec.rb
371
- homepage: http://github.com/ytaka/drbqs
372
- licenses:
373
- - GPL3
272
+ homepage: ''
273
+ licenses: []
374
274
  post_install_message:
375
275
  rdoc_options: []
376
276
  require_paths:
@@ -381,9 +281,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
381
281
  - - ! '>='
382
282
  - !ruby/object:Gem::Version
383
283
  version: '0'
384
- segments:
385
- - 0
386
- hash: -870409089664405769
387
284
  required_rubygems_version: !ruby/object:Gem::Requirement
388
285
  none: false
389
286
  requirements:
@@ -391,8 +288,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
391
288
  - !ruby/object:Gem::Version
392
289
  version: '0'
393
290
  requirements: []
394
- rubyforge_project:
395
- rubygems_version: 1.8.5
291
+ rubyforge_project: drbqs
292
+ rubygems_version: 1.8.10
396
293
  signing_key:
397
294
  specification_version: 3
398
295
  summary: dRuby Queueing System
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.0.16