libis-workflow 2.1.5 → 2.1.7
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 +4 -4
- data/README.md +4 -4
- data/lib/libis/workflow/task.rb +5 -5
- data/lib/libis/workflow/task_group.rb +1 -1
- data/lib/libis/workflow/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9f56cd10757aa347d9853590fdbb493513c3ca8e5fc626388d4b08f5f95fe26
|
4
|
+
data.tar.gz: 4b4f623194705edca7496bebba401d89a039386cbd499c3ef22e5ce289b664c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6faece7fc2cf155034716ab5d393f9b147b3c52bb16b0f3138d5c35ed927b9b6a721d5e0dfde2aea38bd2cf4d748dba83c2b32e3f6690883d2d96dd4d366bf5
|
7
|
+
data.tar.gz: c8e9c07728e6319a7536156e2d2e2b4c9e6891c53d14c69ba35194a86e5cdc4f118143bc5920b77f95dd2667415f082033e8756905aded19924fcc71d29fb1ae
|
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
@@ -60,7 +60,7 @@ module Libis
|
|
60
60
|
(parameter(:retry_count) + 1).times do
|
61
61
|
|
62
62
|
i = run_item(item)
|
63
|
-
item = i if i.is_a?(Libis::Workflow::WorkItem)
|
63
|
+
item = i if i.is_a?(Libis::Workflow::Base::WorkItem)
|
64
64
|
|
65
65
|
# noinspection RubyScope
|
66
66
|
case item.status(namepath)
|
@@ -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
|
|
@@ -218,7 +218,7 @@ module Libis
|
|
218
218
|
raise Libis::WorkflowAbort, "#{e.message} @ #{e.backtrace.first}"
|
219
219
|
|
220
220
|
else
|
221
|
-
item = new_item if new_item.is_a?(Libis::Workflow::WorkItem)
|
221
|
+
item = new_item if new_item.is_a?(Libis::Workflow::Base::WorkItem)
|
222
222
|
parent_item.status_progress(namepath, i + 1)
|
223
223
|
|
224
224
|
ensure
|
@@ -50,7 +50,7 @@ module Libis
|
|
50
50
|
end
|
51
51
|
info 'Running subtask (%d/%d): %s', item, i+1, tasks.size, task.name
|
52
52
|
new_item = task.run item
|
53
|
-
item = new_item if new_item.is_a?(Libis::Workflow::WorkItem)
|
53
|
+
item = new_item if new_item.is_a?(Libis::Workflow::Base::WorkItem)
|
54
54
|
item.status_progress(self.namepath, i+1)
|
55
55
|
item_status = item.status(task.namepath)
|
56
56
|
status_count[item_status] += 1
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Libis
|
2
2
|
module Workflow
|
3
|
-
VERSION = '2.1.
|
3
|
+
VERSION = '2.1.7' 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.7
|
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-
|
11
|
+
date: 2023-08-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|