rbbt-util 5.17.5 → 5.17.6

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: ebbbcd7563b7c4c3bd68ac9ebef1d81318430cf4
4
- data.tar.gz: f3f0e6c0b52149de5fc1d2dfda1e88afda0963e1
3
+ metadata.gz: a76837c4ad8ddaad67f76ad427b0228526f8ced5
4
+ data.tar.gz: 74defa1d2bdae0f8d3c096025d1ab2ce3796c9f0
5
5
  SHA512:
6
- metadata.gz: 8756e82fa2249eae15ffe96ee0cb81b94964f4e0eb84fd1588248440ed12cb9b3030c2801741b66cb44d456fe5ac396784d48789f5b12bcab3bc02ff58d69f16
7
- data.tar.gz: 72210aa14174435437a7420472f231782aa150c990036fcbadd46a44e96b136ebdd5ab6be5146700869d06e38868cbbee2a0aa00c80d24c45ef25a3ce45058be
6
+ metadata.gz: f0e388e93422121f8e66f3e6570761f803da4a69bcbe2192de3098f602e60edf5c6ed7c043d911d9838d2499a2a9ac0b9f108d45f60f5a5ad7d6083e9fda5fc7
7
+ data.tar.gz: c8acbf531e4703da11cbd7c28dcf5bfb1220536c2fef0bf411ae7d9abc73014cb1e296f9a7aa3a5ea4d1b3917dcc9d985b6b868fef5148fe6bd7a8686d555a23
data/lib/rbbt/persist.rb CHANGED
@@ -27,7 +27,7 @@ module Persist
27
27
 
28
28
  def self.newer?(path, file)
29
29
  return true if not Open.exists? file
30
- return true if File.mtime(path) < File.mtime(file)
30
+ return File.mtime(path) - File.mtime(file) if File.mtime(path) < File.mtime(file)
31
31
  return false
32
32
  end
33
33
 
@@ -38,8 +38,9 @@ module Persist
38
38
  check = persist_options[:check]
39
39
  if not check.nil?
40
40
  if Array === check
41
- if check.select{|file| newer? path, file}.any?
42
- Log.medium "Persistence check for #{path} failed in: #{ check.select{|file| newer? path, file} * ", "}"
41
+ newer = check.select{|file| newer? path, file}
42
+ if newer.any?
43
+ Log.medium "Persistence check for #{path} failed in: #{ newer * ", "}"
43
44
  return false
44
45
  end
45
46
  else
@@ -144,10 +144,12 @@ module Misc
144
144
  when Symbol === v
145
145
  str << k.to_s << "=>" << v.to_s
146
146
  when (String === v and v.length > HASH2MD5_MAX_STRING_LENGTH)
147
+ #str << k.to_s << "=>" << v[0..HASH2MD5_MAX_STRING_LENGTH] << v[v.length-3..v.length+3] << v[-3..-1] << "; #{ v.length }"
147
148
  str << k.to_s << "=>" << v[0..HASH2MD5_MAX_STRING_LENGTH] << "; #{ v.length }"
148
149
  when String === v
149
150
  str << k.to_s << "=>" << v
150
151
  when (Array === v and v.length > HASH2MD5_MAX_ARRAY_LENGTH)
152
+ #str << k.to_s << "=>[" << (v[0..HASH2MD5_MAX_ARRAY_LENGTH] + v[v.length-3..v.length+3] + v[-3..-1]) * "," << "; #{ v.length }]"
151
153
  str << k.to_s << "=>[" << v[0..HASH2MD5_MAX_ARRAY_LENGTH] * "," << "; #{ v.length }]"
152
154
  when TSV::Parser === v
153
155
  str << remove_long_items(v)
@@ -272,7 +272,7 @@ class Step
272
272
  end
273
273
 
274
274
  def streaming?
275
- IO === @result or status == :streaming
275
+ IO === @result or @saved_stream or status == :streaming
276
276
  end
277
277
 
278
278
  def running?
@@ -430,29 +430,31 @@ module Workflow
430
430
  end
431
431
 
432
432
  def rec_dependencies(taskname)
433
- if task_dependencies.include? taskname
434
- deps = task_dependencies[taskname]
435
- all_deps = deps.select{|dep| String === dep or Symbol === dep or Array === dep}
436
- deps.each do |dep|
437
- case dep
438
- when Array
439
- dep.first.rec_dependencies(dep.last).each do |d|
440
- if Array === d
441
- all_deps << d
442
- else
443
- all_deps << [dep.first, d]
444
- end
445
- end
446
- when String, Symbol
447
- all_deps.concat rec_dependencies(dep.to_sym)
448
- when DependencyBlock
449
- all_deps << dep.dependency
450
- end
451
- end
452
- all_deps.uniq
453
- else
454
- []
455
- end
433
+ @rec_dependencies ||= begin
434
+ if task_dependencies.include? taskname
435
+ deps = task_dependencies[taskname]
436
+ all_deps = deps.select{|dep| String === dep or Symbol === dep or Array === dep}
437
+ deps.each do |dep|
438
+ case dep
439
+ when Array
440
+ dep.first.rec_dependencies(dep.last).each do |d|
441
+ if Array === d
442
+ all_deps << d
443
+ else
444
+ all_deps << [dep.first, d]
445
+ end
446
+ end
447
+ when String, Symbol
448
+ all_deps.concat rec_dependencies(dep.to_sym)
449
+ when DependencyBlock
450
+ all_deps << dep.dependency
451
+ end
452
+ end
453
+ all_deps.uniq
454
+ else
455
+ []
456
+ end
457
+ end
456
458
  end
457
459
 
458
460
  def task_from_dep(dep)
@@ -98,6 +98,10 @@ class Step
98
98
  def checks
99
99
  rec_dependencies.collect{|dependency| dependency.path }.uniq
100
100
  end
101
+
102
+ def dirty?
103
+ rec_dependencies.collect{|dependency| dependency.path }.uniq.reject{|path| path.exists?}.any?
104
+ end
101
105
 
102
106
  def kill_children
103
107
  begin
@@ -128,30 +132,32 @@ class Step
128
132
  @seen.uniq!
129
133
  end
130
134
 
135
+ return if @seen.empty?
136
+
137
+ @seen.each do |dependency|
138
+ next if dependency == self
139
+ if dependency.streaming? and not dependency.running?
140
+ dependency.clean
141
+ else
142
+ dependency.clean if dependency.error? or dependency.aborted? or dependency.status.nil? or
143
+ (dependency.done? and dependency.dirty?) or
144
+ not (dependency.done? or dependency.running?)
145
+ end
146
+ end
147
+
131
148
  @seen.each do |dependency|
132
149
  next if dependency == self
133
150
  next unless dependencies.include? dependency
134
151
  dependency.dup_inputs
135
152
  end
136
153
 
137
- return if @seen.empty?
138
-
139
154
  log :dependencies, "#{Log.color :magenta, "Dependencies"} #{Log.color :yellow, task.name.to_s || ""}"
140
155
  @seen.each do |dependency|
141
156
  next if dependency == self
142
157
  next unless dependencies.include? dependency
143
158
  Log.info "#{Log.color :cyan, "dependency"} #{Log.color :yellow, task.name.to_s || ""} => #{Log.color :yellow, dependency.task_name.to_s || ""} -- #{Log.color :blue, dependency.path}"
144
159
  begin
145
- if dependency.streaming?
146
- next if dependency.running?
147
- dependency.clean
148
- else
149
- dependency.clean if (dependency.error? or dependency.aborted? or dependency.status.nil? or not (dependency.done? or dependency.running?))
150
- end
151
-
152
- unless dependency.started?
153
- dependency.run(true)
154
- end
160
+ dependency.run(true) unless dependency.started?
155
161
  rescue Aborted
156
162
  Log.error "Aborted dep. #{Log.color :red, dependency.task.name.to_s}"
157
163
  raise $!
@@ -439,7 +445,9 @@ class Step
439
445
 
440
446
  grace
441
447
 
442
- join_stream if status.to_s == "streaming"
448
+ if streaming?
449
+ join_stream
450
+ end
443
451
 
444
452
  return self if not Open.exists? info_file
445
453
 
@@ -53,7 +53,11 @@ def report_msg(status, name, path)
53
53
  task = Log.color(:yellow, parts.pop)
54
54
  workflow = Log.color(:magenta, parts.pop)
55
55
 
56
- status_msg(status) << " " << [workflow, task, path] * " " << "\n"
56
+ if $main_mtime and ($main_mtime - File.mtime(path)) < 0
57
+ status_msg(status) << " " << [workflow, task, path] * " " << " (#{Log.color(:red, "Mtime out of sync") })\n"
58
+ else
59
+ status_msg(status) << " " << [workflow, task, path] * " " << "\n"
60
+ end
57
61
  end
58
62
 
59
63
  def report(step, offset = 0)
@@ -61,6 +65,7 @@ def report(step, offset = 0)
61
65
  path = step.path
62
66
  status = info[:status] || :missing
63
67
  name = info[:name] || File.basename(path)
68
+ status = :unsync if status == :done and not File.exists? path
64
69
  str = " " * offset
65
70
  str << report_msg(status, name, path)
66
71
  info[:dependencies].each do |task,name,path|
@@ -76,5 +81,6 @@ def report(step, offset = 0)
76
81
  end
77
82
 
78
83
  step = get_step file
84
+ $main_mtime = File.exists?(step.path) ? File.mtime(step.path) : nil
79
85
 
80
86
  puts report(step).strip
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.17.5
4
+ version: 5.17.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-12 00:00:00.000000000 Z
11
+ date: 2015-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake