pwrake 2.2.5 → 2.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/lib/pwrake/branch/fiber_queue.rb +9 -2
- data/lib/pwrake/branch/shell.rb +4 -2
- data/lib/pwrake/branch/shell_profiler.rb +4 -4
- data/lib/pwrake/master/fiber_pool.rb +2 -2
- data/lib/pwrake/master/master_application.rb +7 -6
- data/lib/pwrake/misc/mcgp.rb +4 -4
- data/lib/pwrake/nbio.rb +2 -2
- data/lib/pwrake/option/option.rb +5 -0
- data/lib/pwrake/task/task_algorithm.rb +2 -2
- data/lib/pwrake/task/task_wrapper.rb +7 -5
- data/lib/pwrake/version.rb +1 -1
- data/lib/pwrake/worker/executor.rb +1 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d2c9f51a1a5bdbb546c288239917a1284a7d831f4332c339474d5eb4e368a0ac
|
4
|
+
data.tar.gz: dda35b31e72bd380b0e6ee5e1e2d6cdecb66698bfd3167ce792e3b4f95146f4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5999d1c3ac6217ebab9d5e1915f6f9cf6c8c2023fa3fe973a3a3de7dfe751f4b89e5c8b1a31d4a0a9e972a8fb1be8233fb2c357b189f339925194bfde2352e52
|
7
|
+
data.tar.gz: 366a8e85bf26d3af24b9f80f4521c8b222c56985b50c644f337d4e996eb232f8c077df6fbe4a314b5794eb91d840639ce8c13a3e508fc695ea12bf3c4cbd3fad
|
@@ -7,10 +7,11 @@ module Pwrake
|
|
7
7
|
|
8
8
|
class FiberQueue
|
9
9
|
|
10
|
-
def initialize
|
10
|
+
def initialize(log=nil)
|
11
11
|
@q = []
|
12
12
|
@waiter = []
|
13
13
|
@finished = false
|
14
|
+
@log = log
|
14
15
|
end
|
15
16
|
|
16
17
|
def enq(x)
|
@@ -38,7 +39,13 @@ module Pwrake
|
|
38
39
|
def finish
|
39
40
|
@finished = true
|
40
41
|
while f = @waiter.shift
|
41
|
-
|
42
|
+
begin
|
43
|
+
f.resume
|
44
|
+
rescue => exc
|
45
|
+
if @log
|
46
|
+
@log.error(([exc.to_s]+exc.backtrace).join("\n"))
|
47
|
+
end
|
48
|
+
end
|
42
49
|
end
|
43
50
|
end
|
44
51
|
|
data/lib/pwrake/branch/shell.rb
CHANGED
@@ -145,14 +145,16 @@ module Pwrake
|
|
145
145
|
end
|
146
146
|
@status = nil
|
147
147
|
start_time = Time.now
|
148
|
+
start_clock = Pwrake.clock
|
148
149
|
begin
|
149
150
|
_puts(cmd)
|
150
151
|
@status = io_read_loop(&block)
|
151
152
|
ensure
|
152
153
|
end_time = Time.now
|
154
|
+
end_clock = Pwrake.clock
|
153
155
|
@status = @@profiler.profile(@task_id, @task_name, cmd,
|
154
|
-
start_time, end_time,
|
155
|
-
@gnu_time_status)
|
156
|
+
start_time, end_time, end_clock-start_clock,
|
157
|
+
host, @ncore, @status, @gnu_time_status)
|
156
158
|
end
|
157
159
|
end
|
158
160
|
|
@@ -30,12 +30,12 @@ module Pwrake
|
|
30
30
|
end
|
31
31
|
_puts table_header
|
32
32
|
t = Time.now
|
33
|
-
profile(nil,nil,'pwrake_profile_start',t,t)
|
33
|
+
profile(nil,nil,'pwrake_profile_start',t,t,0)
|
34
34
|
end
|
35
35
|
|
36
36
|
def close
|
37
37
|
t = Time.now
|
38
|
-
profile(nil,nil,'pwrake_profile_end',t,t)
|
38
|
+
profile(nil,nil,'pwrake_profile_end',t,t,0)
|
39
39
|
@lock.synchronize do
|
40
40
|
@io.close if @io != nil
|
41
41
|
@io = nil
|
@@ -85,7 +85,7 @@ module Pwrake
|
|
85
85
|
t.strftime("%F %T.%L")
|
86
86
|
end
|
87
87
|
|
88
|
-
def profile(task_id, task_name, cmd, start_time, end_time,
|
88
|
+
def profile(task_id, task_name, cmd, start_time, end_time, elap_clock,
|
89
89
|
host=nil, ncore=nil, status=nil, gnu_time_status=nil)
|
90
90
|
id = @lock.synchronize do
|
91
91
|
id = @id
|
@@ -96,7 +96,7 @@ module Pwrake
|
|
96
96
|
prof = [ id, task_id, task_name, cmd,
|
97
97
|
format_time(start_time),
|
98
98
|
format_time(end_time),
|
99
|
-
"%.
|
99
|
+
"%.6f" % elap_clock,
|
100
100
|
host, ncore, status ]
|
101
101
|
if @gnu_time && gnu_time_status
|
102
102
|
prof.concat(gnu_time_status)
|
@@ -9,14 +9,14 @@ module Pwrake
|
|
9
9
|
@fibers = []
|
10
10
|
@idle_fiber = []
|
11
11
|
@q = []
|
12
|
-
@new_fiber_start_time =
|
12
|
+
@new_fiber_start_time = Pwrake.clock-10
|
13
13
|
end
|
14
14
|
|
15
15
|
def enq(x)
|
16
16
|
@q.push(x)
|
17
17
|
@count += 1
|
18
18
|
if @idle_fiber.empty? and @fibers.size < @max_fiber and
|
19
|
-
|
19
|
+
Pwrake.clock - @new_fiber_start_time > 0.1
|
20
20
|
@idle_fiber << new_fiber
|
21
21
|
end
|
22
22
|
f = @idle_fiber.shift
|
@@ -23,16 +23,17 @@ module Pwrake
|
|
23
23
|
init("pwrake") # <- parse options here
|
24
24
|
@role = @master = Master.new
|
25
25
|
t = Time.now
|
26
|
+
t = Pwrake.clock
|
26
27
|
@master.setup_branches
|
27
28
|
load_rakefile
|
28
29
|
begin
|
29
|
-
Log.debug "init: #{
|
30
|
-
t =
|
30
|
+
Log.debug "init: #{Pwrake.clock-t} sec"
|
31
|
+
t = Pwrake.clock
|
31
32
|
top_level
|
32
|
-
Log.debug "main: #{
|
33
|
-
t =
|
33
|
+
Log.debug "main: #{Pwrake.clock-t} sec"
|
34
|
+
t = Pwrake.clock
|
34
35
|
@failed = @master.finish
|
35
|
-
Log.debug "finish: #{
|
36
|
+
Log.debug "finish: #{Pwrake.clock-t} sec"
|
36
37
|
rescue SystemExit => e
|
37
38
|
@failed = true
|
38
39
|
rescue Exception => e
|
@@ -49,7 +50,7 @@ module Pwrake
|
|
49
50
|
@master.kill_end("INT")
|
50
51
|
@failed = true
|
51
52
|
end
|
52
|
-
Log.info "pwrake elapsed time:
|
53
|
+
Log.info "pwrake elapsed time: %.3f sec"%(Pwrake.clock-START_CLOCK)
|
53
54
|
Kernel.exit(false) if @failed
|
54
55
|
end
|
55
56
|
end
|
data/lib/pwrake/misc/mcgp.rb
CHANGED
@@ -6,7 +6,7 @@ module Pwrake
|
|
6
6
|
module MCGP
|
7
7
|
|
8
8
|
def graph_partition(host_map, target=nil)
|
9
|
-
t1 =
|
9
|
+
t1 = Pwrake.clock
|
10
10
|
wgts = host_map.group_weight_sum
|
11
11
|
if wgts.size > 1
|
12
12
|
list = wgts.size.times.to_a
|
@@ -24,7 +24,7 @@ module Pwrake
|
|
24
24
|
g = GraphTracerNode.new(list,wgts)
|
25
25
|
trace(g,target)
|
26
26
|
g.part_graph
|
27
|
-
t2 =
|
27
|
+
t2 = Pwrake.clock
|
28
28
|
Pwrake::Log.info "Time for TOTAL Graph Partitioning: #{t2-t1} sec"
|
29
29
|
#g.write_dot('dag2.dot')
|
30
30
|
#exit
|
@@ -308,7 +308,7 @@ module Pwrake
|
|
308
308
|
|
309
309
|
# puts "@vertex_id2name[#{i}]=#{@vertex_id2name[i]}, depth=#{depth}, edges="+@edges[i].map{|x| @vertex_id2name[x[0]]}.join("|")
|
310
310
|
|
311
|
-
t1 =
|
311
|
+
t1 = Pwrake.clock
|
312
312
|
if false
|
313
313
|
puts "@vertex_id2name.size=#{@vertex_id2name.size}"
|
314
314
|
if $debug2
|
@@ -358,7 +358,7 @@ module Pwrake
|
|
358
358
|
@part = Metis.mc_part_graph_recursive2(
|
359
359
|
c,@xadj,@adjcny,@vwgt,nil,@tpwgts)
|
360
360
|
end
|
361
|
-
t2 =
|
361
|
+
t2 = Pwrake.clock
|
362
362
|
Pwrake::Log.info "Time for Graph Partitioning: #{t2-t1} sec"
|
363
363
|
count_partition
|
364
364
|
if $debug
|
data/lib/pwrake/nbio.rb
CHANGED
@@ -105,14 +105,14 @@ module NBIO
|
|
105
105
|
end
|
106
106
|
|
107
107
|
def init_heartbeat
|
108
|
-
t =
|
108
|
+
t = Pwrake.clock
|
109
109
|
@hb_check_time = t
|
110
110
|
@hb_time = {}
|
111
111
|
@reader.each_key{|io| @hb_time[io] = t}
|
112
112
|
end
|
113
113
|
|
114
114
|
def check_heartbeat(ios,timeout)
|
115
|
-
t =
|
115
|
+
t = Pwrake.clock
|
116
116
|
if t - @hb_check_time < 3
|
117
117
|
if ios
|
118
118
|
ios.each do |io|
|
data/lib/pwrake/option/option.rb
CHANGED
@@ -19,12 +19,12 @@ module Pwrake
|
|
19
19
|
|
20
20
|
def pw_search_tasks(args)
|
21
21
|
Log.debug "#{self.class}#pw_search_tasks start, task=#{name} args=#{args.inspect}"
|
22
|
-
|
22
|
+
cl = Pwrake.clock
|
23
23
|
task_args = TaskArguments.new(arg_names, args)
|
24
24
|
# not synchronize owing to fiber
|
25
25
|
search_with_call_chain(nil, task_args, InvocationChain::EMPTY)
|
26
26
|
#
|
27
|
-
Log.debug "#{self.class}#pw_search_tasks end #{
|
27
|
+
Log.debug "#{self.class}#pw_search_tasks end #{Pwrake.clock-cl}"
|
28
28
|
end
|
29
29
|
|
30
30
|
# Same as search, but explicitly pass a call chain to detect
|
@@ -65,6 +65,7 @@ module Pwrake
|
|
65
65
|
|
66
66
|
def preprocess
|
67
67
|
@time_start = Time.now
|
68
|
+
@clock_start = Pwrake.clock
|
68
69
|
end
|
69
70
|
|
70
71
|
def retry?
|
@@ -77,15 +78,15 @@ module Pwrake
|
|
77
78
|
|
78
79
|
def postprocess(postproc)
|
79
80
|
@executed = true if !@task.actions.empty?
|
80
|
-
#tm_taskend =
|
81
|
+
#tm_taskend = Pwrake.clock
|
81
82
|
if is_file_task?
|
82
|
-
#t =
|
83
|
+
#t = Pwrake.clock
|
83
84
|
if File.exist?(name)
|
84
85
|
@file_stat = File::Stat.new(name)
|
85
86
|
@location = postproc.run(self)
|
86
87
|
end
|
87
88
|
end
|
88
|
-
#Log.debug "postprocess time=#{
|
89
|
+
#Log.debug "postprocess time=#{Pwrake.clock-tm_taskend}"
|
89
90
|
log_task
|
90
91
|
end
|
91
92
|
|
@@ -109,6 +110,7 @@ module Pwrake
|
|
109
110
|
|
110
111
|
def log_task
|
111
112
|
@time_end = Time.now
|
113
|
+
@clock_end = Pwrake.clock
|
112
114
|
#
|
113
115
|
sug_host = suggest_location()
|
114
116
|
shell = Pwrake::Shell.current
|
@@ -118,7 +120,7 @@ module Pwrake
|
|
118
120
|
end
|
119
121
|
return if !@@task_logger
|
120
122
|
#
|
121
|
-
elap = @
|
123
|
+
elap = @clock_end - @clock_start
|
122
124
|
if has_output_file?
|
123
125
|
RANK_STAT.add_sample(rank,elap)
|
124
126
|
end
|
@@ -148,7 +150,7 @@ module Pwrake
|
|
148
150
|
# preq_loc exec_host shell_id has_action executed ncore
|
149
151
|
# file_size file_mtime file_host write_loc
|
150
152
|
#
|
151
|
-
row = [ @task_id, name, @time_start, @time_end, elap,
|
153
|
+
row = [ @task_id, name, @time_start, @time_end, "%.6f"%elap,
|
152
154
|
prerequisites, sug_host, preq_loc, @exec_host, @shell_id,
|
153
155
|
(actions.empty?) ? 0 : 1,
|
154
156
|
(@executed) ? 1 : 0,
|
data/lib/pwrake/version.rb
CHANGED
@@ -45,7 +45,7 @@ module Pwrake
|
|
45
45
|
@option = option
|
46
46
|
@out = Writer.instance
|
47
47
|
@log = LogExecutor.instance
|
48
|
-
@queue = FiberQueue.new
|
48
|
+
@queue = FiberQueue.new(@log)
|
49
49
|
@rd_list = []
|
50
50
|
@dir = dir_class.new
|
51
51
|
@dir.open
|
@@ -182,9 +182,6 @@ module Pwrake
|
|
182
182
|
@sh_in.close
|
183
183
|
@sh_out.close
|
184
184
|
@sh_err.close
|
185
|
-
if @start_process_fiber.alive?
|
186
|
-
@start_process_fiber.resume # next process
|
187
|
-
end
|
188
185
|
end
|
189
186
|
end
|
190
187
|
rescue => exc
|
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.2.
|
4
|
+
version: 2.2.6
|
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: 2018-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parallel
|
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
136
|
version: '0'
|
137
137
|
requirements: []
|
138
138
|
rubyforge_project:
|
139
|
-
rubygems_version: 2.
|
139
|
+
rubygems_version: 2.7.3
|
140
140
|
signing_key:
|
141
141
|
specification_version: 4
|
142
142
|
summary: Parallel Workflow engine based on Rake
|