rbbt-util 5.26.68 → 5.26.69
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbbt/monitor.rb +67 -63
- data/lib/rbbt/util/cmd.rb +2 -0
- data/share/rbbt_commands/system/clean +6 -1
- data/share/rbbt_commands/system/status +6 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac29954e5bef02280ffae697ea26e1dfde43dd3fc53f9f574de35ddd7196aa65
|
4
|
+
data.tar.gz: fbce52172d122f2bce9084c0aed4cefa6b68c214f15a1ea99bf9ad763298b237
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 582ce34c744828198d4f74e4a1d29c2be07c04e99521cac21a719a1e12b3c53cde1bc70b1a834395cba4a91e0771c5431a2268ea558df66318c48ddd48bcb631
|
7
|
+
data.tar.gz: e5ed71a66cb4e4194a1e4632b6dfda88e7e11f440615252a0ce98415d4c3433e00d942065ed6cbba34d32dbcd31fd538ec503a3bc7d4887538ca143bf5b6a727
|
data/lib/rbbt/monitor.rb
CHANGED
@@ -138,76 +138,80 @@ module Rbbt
|
|
138
138
|
dirs.collect do |dir|
|
139
139
|
next unless Open.exists? dir
|
140
140
|
|
141
|
-
|
142
|
-
|
143
|
-
Open.list_repo_files(*dir_sub_path).collect{|f| f.split("/").first}.uniq.collect{|f| File.join(repo_dir, f)}.uniq
|
144
|
-
else
|
145
|
-
dir.glob("*")
|
146
|
-
end
|
147
|
-
|
148
|
-
workflowdirs.collect do |workflowdir|
|
149
|
-
workflow = File.basename(workflowdir)
|
150
|
-
next if workflows and not workflows.include? workflow
|
151
|
-
|
152
|
-
tasks_dirs = if (dir_sub_path = Open.find_repo_dir(workflowdir))
|
153
|
-
repo_dir, sub_path = dir_sub_path
|
154
|
-
Open.list_repo_files(*dir_sub_path).collect{|f| f.split("/").first}.uniq.collect{|f| File.join(repo_dir, f)}.uniq
|
155
|
-
else
|
156
|
-
workflowdir.glob("*")
|
157
|
-
end
|
158
|
-
|
159
|
-
tasks_dirs.collect do |taskdir|
|
160
|
-
task = File.basename(taskdir)
|
161
|
-
next if tasks and not tasks.include? task
|
162
|
-
|
163
|
-
|
164
|
-
files = if (dir_sub_path = Open.find_repo_dir(taskdir))
|
165
|
-
repo_dir, sub_path = dir_sub_path
|
166
|
-
Open.list_repo_files(*dir_sub_path).reject do |f|
|
167
|
-
f.include?("/.info/") ||
|
168
|
-
f.include?(".files/") ||
|
169
|
-
f.include?(".pid/") ||
|
170
|
-
File.directory?(f)
|
171
|
-
end.collect do |f|
|
172
|
-
File.join(repo_dir, f)
|
173
|
-
end
|
141
|
+
tasks_dirs = if dir == '.'
|
142
|
+
["."]
|
174
143
|
else
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
144
|
+
workflowdirs = if (dir_sub_path = Open.find_repo_dir(workflowdir))
|
145
|
+
repo_dir, sub_path = dir_sub_path
|
146
|
+
Open.list_repo_files(*dir_sub_path).collect{|f| f.split("/").first}.uniq.collect{|f| File.join(repo_dir, f)}.uniq
|
147
|
+
else
|
148
|
+
dir.glob("*")
|
149
|
+
end
|
150
|
+
|
151
|
+
workflowdirs.collect do |workflowdir|
|
152
|
+
workflow = File.basename(workflowdir)
|
153
|
+
next if workflows and not workflows.include? workflow
|
154
|
+
|
155
|
+
if (dir_sub_path = Open.find_repo_dir(workflowdir))
|
156
|
+
repo_dir, sub_path = dir_sub_path
|
157
|
+
Open.list_repo_files(*dir_sub_path).collect{|f| f.split("/").first}.uniq.collect{|f| File.join(repo_dir, f)}.uniq
|
158
|
+
else
|
159
|
+
workflowdir.glob("*")
|
160
|
+
end
|
161
|
+
end.compact.flatten
|
179
162
|
end
|
180
163
|
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
if m = file.match(/(.*)\.(info|pid|files)$/)
|
185
|
-
file = m[1]
|
186
|
-
end
|
187
|
-
next if seen.include? file
|
188
|
-
seen << file
|
164
|
+
tasks_dirs.collect do |taskdir|
|
165
|
+
task = File.basename(taskdir)
|
166
|
+
next if tasks and not tasks.include? task
|
189
167
|
|
190
|
-
name = file[taskdir.length+1..-1]
|
191
|
-
info_file = file + '.info'
|
192
168
|
|
193
|
-
|
169
|
+
files = if (dir_sub_path = Open.find_repo_dir(taskdir))
|
170
|
+
repo_dir, sub_path = dir_sub_path
|
171
|
+
Open.list_repo_files(*dir_sub_path).reject do |f|
|
172
|
+
f.include?("/.info/") ||
|
173
|
+
f.include?(".files/") ||
|
174
|
+
f.include?(".pid/") ||
|
175
|
+
File.directory?(f)
|
176
|
+
end.collect do |f|
|
177
|
+
File.join(repo_dir, f)
|
178
|
+
end
|
179
|
+
else
|
180
|
+
#cmd = "find -L '#{ taskdir }/' -not \\( -path \"#{taskdir}/*.files/*\" -prune \\) -not -name '*.pid' -not -name '*.notify' -not -name '\\.*' 2>/dev/null"
|
181
|
+
cmd = "find -L '#{ taskdir }/' -not \\( -path \"#{taskdir}/.info/*\" -prune \\) -not \\( -path \"#{taskdir}/*.files/*\" -prune \\) -not -name '*.pid' -not -name '*.md5' -not -name '*.notify' -not -name '\\.*' \\( -not -type d -o -name '*.files' \\) 2>/dev/null"
|
182
|
+
|
183
|
+
CMD.cmd(cmd, :pipe => true).read.split("\n")
|
184
|
+
end
|
185
|
+
|
186
|
+
files = files.sort_by{|f| Open.mtime(f) || Time.now}
|
187
|
+
TSV.traverse files, :type => :array, :into => jobs, :_bar => "Finding jobs in #{ taskdir }" do |file|
|
188
|
+
_files << file
|
189
|
+
if m = file.match(/(.*)\.(info|pid|files)$/)
|
190
|
+
file = m[1]
|
191
|
+
end
|
192
|
+
next if seen.include? file
|
193
|
+
seen << file
|
194
194
|
|
195
|
-
|
196
|
-
|
197
|
-
info[:name] = name
|
195
|
+
name = file[taskdir.length+1..-1]
|
196
|
+
info_file = file + '.info'
|
198
197
|
|
199
|
-
|
200
|
-
info = info.merge(file_time(file))
|
201
|
-
info[:done] = true
|
202
|
-
info[:info_file] = Open.exist?(info_file) ? info_file : nil
|
203
|
-
else
|
204
|
-
info = info.merge({:info_file => info_file, :done => false})
|
205
|
-
end
|
198
|
+
info = {}
|
206
199
|
|
207
|
-
|
200
|
+
info[:workflow] = workflow
|
201
|
+
info[:task] = task
|
202
|
+
info[:name] = name
|
203
|
+
|
204
|
+
if Open.exists? file
|
205
|
+
info = info.merge(file_time(file))
|
206
|
+
info[:done] = true
|
207
|
+
info[:info_file] = Open.exist?(info_file) ? info_file : nil
|
208
|
+
else
|
209
|
+
info = info.merge({:info_file => info_file, :done => false})
|
208
210
|
end
|
209
211
|
|
210
|
-
|
212
|
+
[file, info]
|
213
|
+
end
|
214
|
+
|
211
215
|
end.compact.flatten
|
212
216
|
end.compact.flatten
|
213
217
|
jobs
|
@@ -235,7 +239,7 @@ module Rbbt
|
|
235
239
|
jobs[workflow][task] ||= {}
|
236
240
|
files.each do |f|
|
237
241
|
next if f =~ /\.lock$/
|
238
|
-
|
242
|
+
job = f.sub(/\.(info|files)/,'')
|
239
243
|
|
240
244
|
jobs[workflow][task][job] ||= {}
|
241
245
|
if jobs[workflow][task][job][:status].nil?
|
@@ -247,8 +251,8 @@ module Rbbt
|
|
247
251
|
rescue
|
248
252
|
{}
|
249
253
|
end
|
250
|
-
|
251
|
-
|
254
|
+
status = info[:status]
|
255
|
+
pid = info[:pid]
|
252
256
|
end
|
253
257
|
|
254
258
|
jobs[workflow][task][job][:pid] = pid if pid
|
data/lib/rbbt/util/cmd.rb
CHANGED
@@ -79,7 +79,12 @@ puts
|
|
79
79
|
puts Log.color(:magenta, "# Workflow clean")
|
80
80
|
puts
|
81
81
|
|
82
|
-
|
82
|
+
if workflow === ['.']
|
83
|
+
jobs = Rbbt.job_info ["all"], task, ['.']
|
84
|
+
else
|
85
|
+
jobs = Rbbt.job_info workflow, task
|
86
|
+
end
|
87
|
+
|
83
88
|
workflows = {}
|
84
89
|
|
85
90
|
TSV.traverse jobs do |file,i|
|
@@ -152,7 +152,12 @@ workflow = nil if workflow == ["all"]
|
|
152
152
|
|
153
153
|
puts Log.color(:magenta, "# Workflows")
|
154
154
|
|
155
|
-
|
155
|
+
if workflow === ['.']
|
156
|
+
jobs = Rbbt.job_info ["all"], task, ['.']
|
157
|
+
else
|
158
|
+
jobs = Rbbt.job_info workflow, task
|
159
|
+
end
|
160
|
+
|
156
161
|
workflows = {}
|
157
162
|
|
158
163
|
TSV.traverse jobs, :_bar => "Checking job status" do |file,info|
|