rbbt-util 5.21.25 → 5.21.26

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1b21d6a5e58da7ef9971f899e920326df6d34c34
4
- data.tar.gz: 4c18599fdabee42ff93491cff0a738058a1f0913
3
+ metadata.gz: e203165042b07b13e23b68e1866b666f62f4fd23
4
+ data.tar.gz: f5ddf081857b16e545252d75f32b44abdaec95b6
5
5
  SHA512:
6
- metadata.gz: d45b7d8beede9afe141d6968d09feb4a5f49ec1c54db038dfa4d86a21e73494c46249419ce42bf6d6f6bfc6feb054bf271f7529de30313b769d40f4b7a249df6
7
- data.tar.gz: 3bd0a79f7dfc9f8469a21d3ad06d4b94c19134d6b3c37bb225e22783d5c28029539c3f1eaf4e4782b69b5053694cd6a24d16bff3a5d41fef0b07719c997a0dc7
6
+ metadata.gz: 3033f617246ea9979a534f5d381b1a836e91396d43b1045dbbb55cb0ad4cfbd23f92313b8670f4203806a8f1a1304f2bc7cc6e37f8bea61430f75b932face679
7
+ data.tar.gz: aef14c07604f7db9a9b9d3901ccc455e6874911f17ffdb802b7e91654ea2e4f6ff9fcf665b3b6fcf33fa913e58bff70d56ac01974d9d03818b0a351789755fa1
data/lib/rbbt/monitor.rb CHANGED
@@ -133,6 +133,7 @@ module Rbbt
133
133
  tasks = tasks.collect{|w| w.to_s} if tasks
134
134
 
135
135
  jobs = {}
136
+ seen = Set.new
136
137
  dirs.collect do |dir|
137
138
  next unless Open.exists? dir
138
139
 
@@ -144,12 +145,14 @@ module Rbbt
144
145
  task = File.basename(taskdir)
145
146
  next if tasks and not tasks.include? task
146
147
 
147
- files = `find "#{ taskdir }/" -not -type d -not -path "*/*.files/*" 2>/dev/null`.split("\n").sort
148
- _files = Set.new files
149
- TSV.traverse files, :type => :array, :into => jobs do |file|
148
+ cmd = "find '#{ taskdir }/' -not -type d -not -path '*/*.files/*' -not -path '*/*.pid' 2>/dev/null"
149
+ files = CMD.cmd(cmd, :pipe => true)
150
+ TSV.traverse files, :type => :array, :into => jobs, :_bar => "Finding jobs in #{ taskdir }" do |file|
150
151
  if m = file.match(/(.*).(info|pid)$/)
151
152
  file = m[1]
152
153
  end
154
+ next if seen.include? file
155
+ seen << file
153
156
 
154
157
  name = file[taskdir.length+1..-1]
155
158
  info_file = file + '.info'
@@ -14,7 +14,8 @@ Clean orphaned files
14
14
  $ rbbt system clean <workflow> <task>
15
15
 
16
16
  -a--all Apply to all jobs, not only uncompleted
17
- -f--force Remove regardless of been active
17
+ -f--force Remove locks and files regardless of been active
18
+ -q--quick Quick check
18
19
  -h--help Print this help
19
20
  EOF
20
21
  rbbt_usage and exit 0 if options[:help]
@@ -75,24 +76,29 @@ puts
75
76
  jobs = Rbbt.job_info workflow, task
76
77
  workflows = {}
77
78
 
78
- jobs.each do |file,i|
79
- info = begin
80
- Open.open(i[:info_file]) do |f|
81
- Marshal.load(f)
79
+ TSV.traverse jobs, :bar => "Checking job status" do |file,i|
80
+ if options[:quick] and File.exists? file
81
+ status = 'done'
82
+ else
83
+ info = begin
84
+ Open.open(i[:info_file]) do |f|
85
+ Step::INFO_SERIALIAZER.load(f)
86
+ end
87
+ rescue
88
+ {:status => :noinfo}
82
89
  end
83
- rescue
84
- {:status => :noinfo}
85
- end
86
90
 
87
- pid = info[:pid]
91
+ pid = info[:pid]
88
92
 
89
- status = info[:status].to_s
90
- status = :missing if status == "done" and not File.exist? file
91
- status = :nopid if status != "done" and pid.nil?
92
- status = :dead if status != "done" and pid and not Misc.pid_exists?(pid)
93
- status = :sync if status != "done" and File.exist? file
93
+ status = info[:status].to_s
94
+ status = :missing if status == "done" and not File.exist? file
95
+ status = :nopid if status != "done" and pid.nil?
96
+ status = :dead if status != "done" and pid and not Misc.pid_exists?(pid)
97
+ status = :sync if status != "done" and File.exist? file
98
+
99
+ status = status.to_s
100
+ end
94
101
 
95
- status = status.to_s
96
102
  next unless status =~ /\bnopid/ or status =~ /\berror$/ or status =~ /\bmissing$/ or status =~ /\baborted$/ or status =~ /\bdead$/ or status =~ /\bsync$/ or status == "" or (force and status == 'noinfo')
97
103
  puts " Removing #{ file } - #{status}"
98
104
  Step.clean(file)
@@ -15,6 +15,7 @@ $ rbbt system status <workflow> <task>
15
15
 
16
16
  -a--all Print all jobs, not only uncompleted
17
17
  -h--help Print this help
18
+ -q--quick Quick check
18
19
  EOF
19
20
  rbbt_usage and exit 0 if options[:help]
20
21
 
@@ -115,7 +116,7 @@ puts Log.color(:magenta, "# Workflows")
115
116
  jobs = Rbbt.job_info workflow, task
116
117
  workflows = {}
117
118
 
118
- jobs.each do |file,info|
119
+ TSV.traverse jobs, :_bar => "Checking job status" do |file,info|
119
120
  next unless all or not info[:done] or not File.exist? file
120
121
  workflow = info[:workflow]
121
122
  task = info[:task]
@@ -129,23 +130,27 @@ workflows.sort.each do |workflow,tasks|
129
130
  puts "* " << Log.color(:magenta, workflow) << "#" << Log.color(:yellow, task) << ": " << Log.color(:blue, jobs.length.to_s)
130
131
 
131
132
  files_txt = jobs.collect do |file, i|
132
- info = begin
133
- Open.open(i[:info_file]) do |f|
134
- Marshal.load(f)
133
+ if options[:quick] and File.exists? file
134
+ status = 'done'
135
+ else
136
+ info = begin
137
+ Open.open(i[:info_file]) do |f|
138
+ Step::INFO_SERIALIAZER.load(f)
139
+ end
140
+ rescue
141
+ {:status => :noinfo}
135
142
  end
136
- rescue
137
- {:status => :noinfo}
138
- end
139
-
140
- pid = info[:pid]
141
- status = info[:status]
142
- status = :missing if status == :done and not File.exist? file
143
- status = status.to_s
144
- if status != "done" and pid and not Misc.pid_exists?(pid)
145
- if File.exist? file
146
- status << Log.color(:red, " (out of sync)")
147
- else
148
- status << Log.color(:red, " (dead)")
143
+
144
+ pid = info[:pid]
145
+ status = info[:status]
146
+ status = :missing if status == :done and not File.exist? file
147
+ status = status.to_s
148
+ if status != "done" and pid and not Misc.pid_exists?(pid)
149
+ if File.exist? file
150
+ status << Log.color(:red, " (out of sync)")
151
+ else
152
+ status << Log.color(:red, " (dead)")
153
+ end
149
154
  end
150
155
  end
151
156
  str = file.dup
@@ -153,7 +158,9 @@ workflows.sort.each do |workflow,tasks|
153
158
  str << "; #{pid_msg pid}" unless status == "done"
154
159
  str
155
160
  end
161
+
156
162
  files_txt.each do |f|
163
+ next if f.nil?
157
164
  puts " " << f
158
165
  end
159
166
  end
@@ -447,7 +447,7 @@ when (defined?(WorkflowRESTClient) and WorkflowRESTClient::RemoteStep)
447
447
  res.join if res.respond_to? :join
448
448
  elsif res.nil?
449
449
  job.join
450
- puts Open.read(job.path)
450
+ puts Open.read(job.path, :nocache => true)
451
451
  else
452
452
  puts res.to_s
453
453
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbt-util
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.21.25
4
+ version: 5.21.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-11 00:00:00.000000000 Z
11
+ date: 2016-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake