libis-workflow 2.1.4 → 2.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -4
- data/lib/libis/workflow/task.rb +13 -3
- data/lib/libis/workflow/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27ae10e41a3a147effde1d6c4778236dc1d4e6671684d8e9b08d5b1684e01a7a
|
4
|
+
data.tar.gz: 1e21e8addccd4e08fcb795b9bfb64ff6e64e2489b9c8749ac79c3f65d475a315
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e36b676594edeba060efdc8cdabf325684c93b3c8d669188e6d4c2fe710e9fdf8c6c83c28b4fe3f1710362f799f0d3cf738410fe014f5258af68a739ea343f9d
|
7
|
+
data.tar.gz: 4c15558469b3790923aeacb1bea1da6b08bfc3b6b0c2fa871430c79f5189e05578db4d98ff4c648be3d31d39d8899bfbc6675bd3db2fc7f068a8d4f1b3462022
|
data/README.md
CHANGED
@@ -258,7 +258,7 @@ perform on each work item:
|
|
258
258
|
|
259
259
|
class MyTask < ::Libis::Workflow::Task
|
260
260
|
|
261
|
-
def
|
261
|
+
def process(item)
|
262
262
|
if do_something(item)
|
263
263
|
info "Did something"
|
264
264
|
else
|
@@ -274,7 +274,7 @@ perform on each work item:
|
|
274
274
|
end
|
275
275
|
```
|
276
276
|
|
277
|
-
As seen above, the task should define a method called
|
277
|
+
As seen above, the task should define a method called process that takes one argument. The argument will be a
|
278
278
|
reference to the work item that it needs to perform an action on. The task has several option to progress after
|
279
279
|
performing its actions:
|
280
280
|
* return. This is considered a normal and successful operation result. After a successful return the item's status will
|
@@ -297,7 +297,7 @@ help of workflow input parameters and run options.
|
|
297
297
|
|
298
298
|
#### Performing an action on the work item and all child items recursively
|
299
299
|
|
300
|
-
With the 'recursive' parameter set to true, your task's
|
300
|
+
With the 'recursive' parameter set to true, your task's process method will be called for the work item and then
|
301
301
|
once for each child and each child's children recursively.
|
302
302
|
|
303
303
|
Note: you should not make both parent and child tasks recursive as this will cause the subitems to be processed
|
@@ -318,7 +318,7 @@ parameter 'retry_interval', which is 30 by default.
|
|
318
318
|
|
319
319
|
### Pre- and postprocessing
|
320
320
|
|
321
|
-
The default implementation of
|
321
|
+
The default implementation of running a task is to call 'pre_process' and then call 'process' for each child item,
|
322
322
|
followed by calling 'post_process'. The methods 'pre_process' and 'post_process' are no-operation methods by default,
|
323
323
|
but can be overwritten if needed.
|
324
324
|
|
data/lib/libis/workflow/task.rb
CHANGED
@@ -97,8 +97,8 @@ module Libis
|
|
97
97
|
|
98
98
|
rescue Exception => e
|
99
99
|
set_status item, :FAILED
|
100
|
-
fatal_error "
|
101
|
-
|
100
|
+
fatal_error "Aborting ingest because of error: %s @ %s\n%s", item, e.message, e.backtrace.first, e.backtrace.map{|t| ' -- ' + t}.join("\n")
|
101
|
+
raise Libis::WorkflowAbort, "#{e.message} @ #{e.backtrace.first}"
|
102
102
|
|
103
103
|
ensure
|
104
104
|
item.save!
|
@@ -209,7 +209,7 @@ module Libis
|
|
209
209
|
break if parameter(:abort_recursion_on_failure)
|
210
210
|
|
211
211
|
rescue Libis::WorkflowAbort => e
|
212
|
-
fatal_error 'Fatal error processing subitem (%d/%d): %s', item, i + 1, items.size, e.message
|
212
|
+
fatal_error 'Fatal error processing subitem (%d/%d): %s @ %s\n%s', item, i + 1, items.size, e.message, e.backtrace.first, e.backtrace.map{|t| ' -- ' + t}.join("\n")
|
213
213
|
item.set_status(namepath, :FAILED)
|
214
214
|
break
|
215
215
|
|
@@ -240,6 +240,16 @@ module Libis
|
|
240
240
|
def substatus_check(status_count, item, task_or_item)
|
241
241
|
item_status = :DONE
|
242
242
|
|
243
|
+
if (not_started = status_count[:NOT_STARTED]) > 0
|
244
|
+
error "%d sub#{task_or_item}(s) not started", item, not_started
|
245
|
+
item_status = :FAILED
|
246
|
+
end
|
247
|
+
|
248
|
+
if (started = status_count[:STARTED]) > 0
|
249
|
+
error "%d sub#{task_or_item}(s) started but not done", item, started
|
250
|
+
item_status = :FAILED
|
251
|
+
end
|
252
|
+
|
243
253
|
if (waiting = status_count[:ASYNC_WAIT]) > 0
|
244
254
|
info "waiting for %d sub#{task_or_item}(s) in async process", item, waiting
|
245
255
|
item_status = :ASYNC_WAIT
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Libis
|
2
2
|
module Workflow
|
3
|
-
VERSION = '2.1.
|
3
|
+
VERSION = '2.1.6' 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.
|
4
|
+
version: 2.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kris Dekeyser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -163,8 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
163
163
|
- !ruby/object:Gem::Version
|
164
164
|
version: '0'
|
165
165
|
requirements: []
|
166
|
-
|
167
|
-
rubygems_version: 2.7.8
|
166
|
+
rubygems_version: 3.1.6
|
168
167
|
signing_key:
|
169
168
|
specification_version: 4
|
170
169
|
summary: LIBIS Workflow framework.
|