rbbt-util 5.26.68 → 5.26.69

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8b8ed0fc568f3cb1688d21b40a222d37b6e301c56c1eb18d6fb46838f880f4b5
4
- data.tar.gz: dc964179d48405b167b03490cf1fa57d44e94c2811921473475ec51d762cd901
3
+ metadata.gz: ac29954e5bef02280ffae697ea26e1dfde43dd3fc53f9f574de35ddd7196aa65
4
+ data.tar.gz: fbce52172d122f2bce9084c0aed4cefa6b68c214f15a1ea99bf9ad763298b237
5
5
  SHA512:
6
- metadata.gz: 61db65a33fe163ea64638de873211e5ebb63c56e0aa502e9e50cbe2ebdba8aba691b624802cc1b2abe22bafeaae2b50942f392a0e352c2d6eda854d478d6989e
7
- data.tar.gz: 83bb4b7b4a7f19f3a815da2d57035a4cd25ec6a2998eccc9a8ce0b9f59bb47baecee28d30b7266178b1842cad3dd86b135ca1e5359e0ad3724f9208e210a55e0
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
- workflowdirs = if (dir_sub_path = Open.find_repo_dir(workflowdir))
142
- repo_dir, sub_path = dir_sub_path
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
- #cmd = "find -L '#{ taskdir }/' -not \\( -path \"#{taskdir}/*.files/*\" -prune \\) -not -name '*.pid' -not -name '*.notify' -not -name '\\.*' 2>/dev/null"
176
- 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"
177
-
178
- CMD.cmd(cmd, :pipe => true).read.split("\n")
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
- files = files.sort_by{|f| Open.mtime(f) || Time.now}
182
- TSV.traverse files, :type => :array, :into => jobs, :_bar => "Finding jobs in #{ taskdir }" do |file|
183
- _files << file
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
- info = {}
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
- info[:workflow] = workflow
196
- info[:task] = task
197
- info[:name] = name
195
+ name = file[taskdir.length+1..-1]
196
+ info_file = file + '.info'
198
197
 
199
- if Open.exists? file
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
- [file, info]
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
- end.compact.flatten
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
- job = f.sub(/\.(info|files)/,'')
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
- status = info[:status]
251
- pid = info[:pid]
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
@@ -146,6 +146,8 @@ module CMD
146
146
  all_args << {} unless Hash === all_args.last
147
147
 
148
148
  level = all_args.last[:log] || 0
149
+ level = 0 if TrueClass === level
150
+ level = 10 if FalseClass === level
149
151
  level = level.to_i
150
152
 
151
153
  all_args.last[:log] = true
@@ -79,7 +79,12 @@ puts
79
79
  puts Log.color(:magenta, "# Workflow clean")
80
80
  puts
81
81
 
82
- jobs = Rbbt.job_info workflow, task
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
- jobs = Rbbt.job_info workflow, task
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|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbt-util
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.26.68
4
+ version: 5.26.69
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez