libis-workflow 2.1.8 → 2.1.9

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
  SHA256:
3
- metadata.gz: 0ca60cb469baf356cfdbfc24d5b67213b407d1a03d31aac4282fef76e618ee21
4
- data.tar.gz: 3d63a8d33290b99cd93c96881dc9bff5bc3d8931430ab81563d5f9db80903127
3
+ metadata.gz: 2074a9c80b7a99a427641c2a92d910ee47cf9bb4c9c212d207a27a6b8ea07a3f
4
+ data.tar.gz: ef7374f1aa151f0502849059e63e97cf6faf144b2b662e4246ddc50e1027f3b3
5
5
  SHA512:
6
- metadata.gz: 88de25eccc8af1d2e57d70cd97687c1b7d37ef086d1b3315398836c6e00277645f128d5718d316b1f5445e4320ab14c0c4b30bc482ae69a3a04e57f0c26073c4
7
- data.tar.gz: c69167119af26dc0fd7d0c526bfdf117c4fec427a296c54576bc5a96eb160b5667600f20c5d97208516296d0c09f00b8454791055bb5e006dcdff52349037e69
6
+ metadata.gz: 7aa230d3a1524e1cc72a8a539aa9fa575bbd6f239298ad0b183632c3a7fadd33120048e02e86a7fd7c8072880548835a93afc79819a7af7c3bd0d037d7b35b0e
7
+ data.tar.gz: 98419ed9d9736a21941bcf7033f9ad293c4caf1859c382845cc3e6a72caea98547d84246ef5b7606655a7b5bee283a406e979294ea6dafa487a89f9103642861
@@ -38,6 +38,10 @@ module Libis
38
38
  raise Libis::WorkflowError, "Processing task '#{namepath}' is not allowed to have subtasks."
39
39
  end
40
40
 
41
+ def root_task
42
+ parent&.root_task || self
43
+ end
44
+
41
45
  # @param [Libis::Workflow::Base::WorkItem] item
42
46
  def run(item)
43
47
  check_item_type ::Libis::Workflow::Base::WorkItem, item
@@ -232,11 +236,17 @@ module Libis
232
236
 
233
237
  end
234
238
 
235
- # noinspection RubyScope
236
- debug '%d of %d subitems passed', parent_item, status_count[:DONE], items.size
237
239
  substatus_check(status_count, parent_item, 'item')
238
240
  end
239
241
 
242
+ def global_status(item)
243
+ results = Hash.new(0)
244
+ self.tasks.each { |subtask| results[item.status(subtask.namepath)] += 1 }
245
+ [:FAILED, :ASYNC_WAIT, :ASYNC_HALT].each { |status| return status if results[status] > 0 }
246
+ return :FAILED if results[:STARTED] > 1
247
+ :DONE
248
+ end
249
+
240
250
  def substatus_check(status_count, item, task_or_item)
241
251
  item_status = :DONE
242
252
 
@@ -264,6 +274,10 @@ module Libis
264
274
  item_status = :FAILED
265
275
  end
266
276
 
277
+ if (done = status_count[:DONE]) > 0
278
+ debug "%d sub#{task_or_item}(s) passed", item, done
279
+ end
280
+
267
281
  set_status(item, item_status)
268
282
  end
269
283
 
@@ -1,5 +1,5 @@
1
1
  module Libis
2
2
  module Workflow
3
- VERSION = '2.1.8' unless const_defined? :VERSION # the guard is against a redefinition warning that happens on Travis
3
+ VERSION = '2.1.9' unless const_defined? :VERSION # the guard is against a redefinition warning that happens on Travis
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libis-workflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.8
4
+ version: 2.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kris Dekeyser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-09 00:00:00.000000000 Z
11
+ date: 2023-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake