pwrake 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +33 -13
- data/lib/pwrake/branch/branch.rb +1 -1
- data/lib/pwrake/iomux/handler.rb +1 -1
- data/lib/pwrake/master/master.rb +17 -15
- data/lib/pwrake/option/host_map.rb +4 -2
- data/lib/pwrake/option/option.rb +1 -0
- data/lib/pwrake/queue/queue_array.rb +0 -2
- data/lib/pwrake/task/task_property.rb +4 -1
- data/lib/pwrake/task/task_wrapper.rb +14 -0
- data/lib/pwrake/version.rb +1 -1
- data/lib/pwrake/worker/executor.rb +9 -8
- data/lib/pwrake/worker/gfarm_directory.rb +1 -1
- data/lib/pwrake/worker/invoker.rb +1 -3
- data/lib/pwrake/worker/worker_main.rb +1 -0
- metadata +3 -5
- data/README +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3d87023233f03e030697675ddd3869f47f1784a
|
4
|
+
data.tar.gz: 984fc85baa604dfbd0092e833f193e74c56b5a71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de7d46e56c7487ad87b70b47c5f6d60b0d8231c16b0f86f40aa3437f4618c949986cb14293b05af853a72573f9f110be6ce665905027673b3ad7c2e38a3e911e
|
7
|
+
data.tar.gz: 767e0e3e4a88dfc64224c4358023bde7761084265783386f981b78d60ecd3c573438929a0e426443be1f21b70ba4db5988c5bd9f198586004d3ac4ca8efcdde4
|
data/README.md
CHANGED
@@ -1,18 +1,27 @@
|
|
1
1
|
# Pwrake
|
2
2
|
|
3
|
-
Parallel
|
3
|
+
Parallel Workflow extension for Rake, runs on multicores, clusters, clouds.
|
4
4
|
* Author: Masahiro Tanaka
|
5
5
|
|
6
|
-
([README in Japanese](https://github.com/masa16/pwrake/wiki/Pwrake
|
7
|
-
([GitHub Repository](https://github.com/masa16/pwrake))
|
6
|
+
([README in Japanese](https://github.com/masa16/pwrake/wiki/Pwrakeとは)),
|
7
|
+
([GitHub Repository](https://github.com/masa16/pwrake)),
|
8
|
+
([RubyGems](https://rubygems.org/gems/pwrake))
|
8
9
|
|
9
10
|
## Features
|
10
11
|
|
11
|
-
*
|
12
|
-
*
|
13
|
-
*
|
14
|
-
*
|
15
|
-
*
|
12
|
+
* Pwrake executes a workflow written in Rakefile in parallel.
|
13
|
+
* The specification of Rakefile is same as Rake.
|
14
|
+
* The tasks which do not have mutual dependencies are automatically executed in parallel.
|
15
|
+
* The `multitask` which is a parallel task definition of Rake is no more necessary.
|
16
|
+
* Parallel and distributed execution is possible using a computer cluster which consists of multiple compute nodes.
|
17
|
+
* Cluster settings: SSH login, and the directory sharing using a shared filesystem, e.g., NFS, Gfarm.
|
18
|
+
* Pwrake automatically connects to remote hosts using SSH. You do not need to start a daemon.
|
19
|
+
* Remote host names and the number of cores to use are provided in a hostfile.
|
20
|
+
* [Gfarm file system](http://sourceforge.net/projects/gfarm/) utilizes storage of compute nodes. It provides the high-performance parallel I/O.
|
21
|
+
* Parallel I/O access to local stroage of compute nodes enables scalable increase in the I/O performance.
|
22
|
+
* Gfarm schedules a compute node to store an output file, to local storage.
|
23
|
+
* Pwrake schedules a compute node to execute a task, to a node where input files are stored.
|
24
|
+
* Other supports for Gfarm: Automatic mount of the Gfarm file system, etc.
|
16
25
|
|
17
26
|
## Installation
|
18
27
|
|
@@ -97,7 +106,8 @@ Or, gem install:
|
|
97
106
|
SHELL_COMMAND default=$SHELL
|
98
107
|
SHELL_RC Run-Command when shell starts
|
99
108
|
PASS_ENV (Array) Environment variables passed to SSH
|
100
|
-
HEARTBEAT defulat=240 - Hearbeat interval in seconds
|
109
|
+
HEARTBEAT defulat=240 - Hearbeat interval in seconds
|
110
|
+
RETRY default=0 - The number of default task retry
|
101
111
|
FAILED_TARGET rename(default)|delete|leave - Treatment of failed target files
|
102
112
|
FAILURE_TERMINATION wait(default)|kill|continue - Behavior of other tasks when a task is failed
|
103
113
|
QUEUE_PRIORITY LIHR(default)|FIFO|LIFO|RANK
|
@@ -123,10 +133,19 @@ Or, gem install:
|
|
123
133
|
|
124
134
|
Example of Rakefile:
|
125
135
|
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
136
|
+
``` ruby
|
137
|
+
desc "ncore=4 allow=ourhost*" # desc has no effect on rule in original Rake, but it is used for task property in Pwrake.
|
138
|
+
rule ".o" => ".c" do
|
139
|
+
sh "..."
|
140
|
+
end
|
141
|
+
|
142
|
+
(1..n).each do |i|
|
143
|
+
desc "ncore=2 steal=no" # desc should be inside of loop because it is effective only for the next task.
|
144
|
+
file "task#{i}" do
|
145
|
+
sh "..."
|
146
|
+
end
|
147
|
+
end
|
148
|
+
```
|
130
149
|
|
131
150
|
Properties (The leftmost item is default):
|
132
151
|
|
@@ -136,6 +155,7 @@ Properties (The leftmost item is default):
|
|
136
155
|
deny=hostname - Deny this host to execute this task. (accepts wild card)
|
137
156
|
order=deny,allow|allow,deny - The order of evaluation.
|
138
157
|
steal=yes|no - Allow task stealing for this task.
|
158
|
+
retry=integer - The number of retry for this task.
|
139
159
|
|
140
160
|
## Note for Gfarm
|
141
161
|
|
data/lib/pwrake/branch/branch.rb
CHANGED
data/lib/pwrake/iomux/handler.rb
CHANGED
data/lib/pwrake/master/master.rb
CHANGED
@@ -203,22 +203,24 @@ module Pwrake
|
|
203
203
|
# check failure
|
204
204
|
if tw.status == "fail"
|
205
205
|
$stderr.puts %[task "#{tw.name}" failed.]
|
206
|
-
if
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
206
|
+
if !tw.retry
|
207
|
+
if !@failed
|
208
|
+
@failed = true
|
209
|
+
case @option['FAILURE_TERMINATION']
|
210
|
+
when 'kill'
|
211
|
+
@hdl_set.kill("INT")
|
212
|
+
@no_more_run = true
|
213
|
+
$stderr.puts "... Kill running tasks."
|
214
|
+
when 'continue'
|
215
|
+
$stderr.puts "... Continue runable tasks."
|
216
|
+
else # 'wait'
|
217
|
+
@no_more_run = true
|
218
|
+
$stderr.puts "... Wait for running tasks."
|
219
|
+
end
|
220
|
+
end
|
221
|
+
if tw.has_output_file? && File.exist?(tw.name)
|
222
|
+
handle_failed_target(tw.name)
|
218
223
|
end
|
219
|
-
end
|
220
|
-
if tw.has_output_file? && File.exist?(tw.name)
|
221
|
-
handle_failed_target(tw.name)
|
222
224
|
end
|
223
225
|
end
|
224
226
|
# postprocess
|
@@ -122,12 +122,14 @@ module Pwrake
|
|
122
122
|
info_list
|
123
123
|
end
|
124
124
|
|
125
|
+
REGEX_RANGE = /\[\[([\w\d]+)-([\w\d]+)\]\]/o
|
126
|
+
|
125
127
|
def parse_line(info_list,line)
|
126
128
|
line = $1 if /^([^#]*)#/ =~ line
|
127
129
|
host, ncore, weight, group = line.split
|
128
130
|
if host
|
129
|
-
if
|
130
|
-
hosts = ($1..$2).map{|i| host.sub(
|
131
|
+
if REGEX_RANGE =~ host
|
132
|
+
hosts = ($1..$2).map{|i| host.sub(REGEX_RANGE,i)}
|
131
133
|
else
|
132
134
|
hosts = [host]
|
133
135
|
end
|
data/lib/pwrake/option/option.rb
CHANGED
@@ -178,6 +178,7 @@ module Pwrake
|
|
178
178
|
['NUM_THREADS', proc{|v| v && v.to_i}],
|
179
179
|
['SHELL_START_INTERVAL', proc{|v| (v || 0.012).to_f}],
|
180
180
|
['HEARTBEAT', proc{|v| (v || 240).to_i}],
|
181
|
+
['RETRY', proc{|v| (v || 0).to_i}],
|
181
182
|
['DISABLE_AFFINITY', proc{|v| v || ENV['AFFINITY']=='off'}],
|
182
183
|
['DISABLE_STEAL', proc{|v| v || ENV['STEAL']=='off'}],
|
183
184
|
['GFARM_BASEDIR', proc{|v| v || '/tmp'}],
|
@@ -3,12 +3,15 @@ module Pwrake
|
|
3
3
|
class TaskProperty
|
4
4
|
|
5
5
|
attr_reader :ncore, :exclusive, :allow, :deny, :order_allow_deny,
|
6
|
-
:disable_steal
|
6
|
+
:retry, :disable_steal
|
7
7
|
|
8
8
|
def parse_description(description)
|
9
9
|
if /\bn_?cores?[=:]\s*([+-]?\d+)/i =~ description
|
10
10
|
@ncore = $1.to_i
|
11
11
|
end
|
12
|
+
if /\bretry[=:]\s*(\d+)/i =~ description
|
13
|
+
@retry = $1.to_i
|
14
|
+
end
|
12
15
|
if /\bexclusive[=:]\s*(\S+)/i =~ description
|
13
16
|
if /^(y|t)/i =~ $1
|
14
17
|
@exclusive = true
|
@@ -27,6 +27,7 @@ module Pwrake
|
|
27
27
|
@executed = false
|
28
28
|
@assigned = []
|
29
29
|
@exec_host = nil
|
30
|
+
@nretry = @property.retry || Rake.application.pwrake_options["RETRY"] || 0
|
30
31
|
end
|
31
32
|
|
32
33
|
def_delegators :@task, :name, :actions, :prerequisites, :subsequents
|
@@ -65,6 +66,19 @@ module Pwrake
|
|
65
66
|
@time_start = Time.now
|
66
67
|
end
|
67
68
|
|
69
|
+
def retry
|
70
|
+
if @nretry > 0
|
71
|
+
s="retry task: #{name}"
|
72
|
+
Log.debug(s)
|
73
|
+
$stderr.puts(s)
|
74
|
+
@nretry -= 1
|
75
|
+
Rake.application.task_queue.enq(self)
|
76
|
+
true
|
77
|
+
else
|
78
|
+
false
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
68
82
|
def postprocess(location)
|
69
83
|
@executed = true if !@task.actions.empty?
|
70
84
|
tm_taskend = Time.now
|
data/lib/pwrake/version.rb
CHANGED
@@ -32,12 +32,12 @@ module Pwrake
|
|
32
32
|
begin
|
33
33
|
@dir.open
|
34
34
|
@dir.open_messages.each{|m| @log.info(m)}
|
35
|
+
@pid = Kernel.spawn(@shell_cmd,
|
36
|
+
:out=>@spawn_out,
|
37
|
+
:err=>@spawn_err,
|
38
|
+
:in=>@spawn_in,
|
39
|
+
:chdir=>@dir.current)
|
35
40
|
begin
|
36
|
-
@pid = Kernel.spawn(@shell_cmd,
|
37
|
-
:out=>@spawn_out,
|
38
|
-
:err=>@spawn_err,
|
39
|
-
:in=>@spawn_in,
|
40
|
-
:chdir=>@dir.current)
|
41
41
|
@out.puts "#{@id}:open"
|
42
42
|
@shell_rc.each do |cmd|
|
43
43
|
run_rc(cmd)
|
@@ -50,10 +50,11 @@ module Pwrake
|
|
50
50
|
ensure
|
51
51
|
status = nil
|
52
52
|
begin
|
53
|
-
timeout(5){
|
53
|
+
Timeout.timeout(5){
|
54
54
|
pid,status = Process.waitpid2(@pid)
|
55
55
|
}
|
56
|
-
rescue
|
56
|
+
rescue => exc
|
57
|
+
@log.error ([exc.to_s]+exc.backtrace).join("\n")
|
57
58
|
@log.info("#{@id}:kill INT sh @pid=#{@pid}")
|
58
59
|
Process.kill("INT",@pid)
|
59
60
|
pid,status = Process.waitpid2(@pid)
|
@@ -62,7 +63,7 @@ module Pwrake
|
|
62
63
|
end
|
63
64
|
rescue => exc
|
64
65
|
@out.puts "#{@id}:exc:#{exc}"
|
65
|
-
@log.error exc
|
66
|
+
@log.error ([exc.to_s]+exc.backtrace).join("\n")
|
66
67
|
ensure
|
67
68
|
@dir.close_messages.each{|m| @log.info(m)}
|
68
69
|
@dir.close
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require "timeout"
|
2
|
-
|
3
1
|
module Pwrake
|
4
2
|
|
5
3
|
class Invoker
|
@@ -158,7 +156,7 @@ module Pwrake
|
|
158
156
|
end
|
159
157
|
@log.info "worker:end:#{id_list.inspect}"
|
160
158
|
begin
|
161
|
-
timeout(20){@log.close}
|
159
|
+
Timeout.timeout(20){@log.close}
|
162
160
|
rescue => e
|
163
161
|
$stdout.puts e
|
164
162
|
$stdout.puts e.backtrace.join("\n")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pwrake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masahiro TANAKA
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Parallel workflow extension for Rake
|
14
14
|
email:
|
@@ -24,7 +24,6 @@ files:
|
|
24
24
|
- CHANGES_V2.md
|
25
25
|
- Gemfile
|
26
26
|
- MIT-LICENSE
|
27
|
-
- README
|
28
27
|
- README.md
|
29
28
|
- Rakefile
|
30
29
|
- bin/gfwhere-pipe
|
@@ -119,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
118
|
version: '0'
|
120
119
|
requirements: []
|
121
120
|
rubyforge_project:
|
122
|
-
rubygems_version: 2.
|
121
|
+
rubygems_version: 2.5.1
|
123
122
|
signing_key:
|
124
123
|
specification_version: 4
|
125
124
|
summary: Adding Parallel and Distributed feature to Rake
|
@@ -141,4 +140,3 @@ test_files:
|
|
141
140
|
- spec/helper.rb
|
142
141
|
- spec/hosts
|
143
142
|
- spec/pwrake_spec.rb
|
144
|
-
has_rdoc:
|