pwrake 2.2.9 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -108,6 +108,7 @@ module Pwrake
108
108
  def start_process(command)
109
109
  return if @thread # running
110
110
  return if !command # empty queue
111
+ @dir.check_mountpoint
111
112
  @spawn_in, @sh_in = IO.pipe
112
113
  @sh_out, @spawn_out = IO.pipe
113
114
  @sh_err, @spawn_err = IO.pipe
@@ -73,19 +73,51 @@ module Pwrake
73
73
 
74
74
  def close
75
75
  super
76
- if File.directory? @gfarm_mountpoint
76
+ n = 0
77
+ while n < 4
77
78
  begin
78
- spawn_cmd "fusermount -u #{@gfarm_mountpoint}"
79
- rescue
79
+ if mounted?
80
+ sleep 0.15 * 4**n
81
+ spawn_cmd "fusermount -u #{@gfarm_mountpoint}"
82
+ end
83
+ n = 99
84
+ rescue => e
85
+ @log.error e.message+" n=#{n}"
86
+ n += 1
80
87
  end
81
- #system "sync"
88
+ end
89
+ if File.directory? @gfarm_mountpoint
82
90
  begin
83
91
  FileUtils.rmdir @gfarm_mountpoint
84
- @log.info "rmdir #{@gfarm_mountpoint} @#{@@hostname}"
92
+ @log.info "rmdir #{@@hostname}:#{@gfarm_mountpoint}"
85
93
  rescue
86
- @log.error "failed to rmdir #{@gfarm_mountpoint} @#{@@hostname}"
94
+ @log.error "failed to rmdir #{@@hostname}:#{@gfarm_mountpoint}"
95
+ end
96
+ end
97
+ if File.exist? @gfarm_mountpoint
98
+ @log.warn "mountpoint #{@@hostname}:#{@gfarm_mountpoint} remains"
99
+ end
100
+ end
101
+
102
+ def mounted?
103
+ File.open('/etc/mtab','r') do |f|
104
+ f.each_line do |l|
105
+ a = l.split
106
+ if a[1] == @gfarm_mountpoint && a[2] =~ /gfarm2fs/
107
+ return true
108
+ end
87
109
  end
88
110
  end
111
+ false
112
+ end
113
+
114
+ def check_mountpoint
115
+ # try to recover from gfarm2fs segfault
116
+ unless File.directory?(@gfarm_mountpoint)
117
+ @log.warn "remounting #{@@hostname}:#{@gfarm_mountpoint}"
118
+ close
119
+ open
120
+ end
89
121
  end
90
122
 
91
123
  end
@@ -70,5 +70,8 @@ module Pwrake
70
70
  work_path + @@log_dir
71
71
  end
72
72
 
73
+ def check_mountpoint
74
+ end
75
+
73
76
  end
74
77
  end
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.9
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masahiro TANAKA
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-14 00:00:00.000000000 Z
11
+ date: 2019-07-30 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Parallel and distributed Rake for workflow execution on multicores, clusters,
14
14
  clouds using SSH. It has locality-aware scheduling designed for Gfarm file system.
@@ -62,6 +62,7 @@ files:
62
62
  - lib/pwrake/option/option_gfarm2fs.rb
63
63
  - lib/pwrake/queue/locality_aware_queue.rb
64
64
  - lib/pwrake/queue/no_action_queue.rb
65
+ - lib/pwrake/queue/non_locality_queue.rb
65
66
  - lib/pwrake/queue/queue_array.rb
66
67
  - lib/pwrake/queue/task_queue.rb
67
68
  - lib/pwrake/report.rb