ductwork 0.8.0 → 0.8.1
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6fde482283602dcf363baed46b5d8468757ddb8f6cc6fabb9b9d5e37497e10f4
|
|
4
|
+
data.tar.gz: 3aa0f1a9aa6f77b47997b64b246ed3dc7371e63554943110de8e06f98135f9d3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bc475be1df97dada6099f8210b5694cbc4d90e5466d565a50674bac796fc252923f19a18e6beae3cf673db8d25fccf4bfb8178622d8574fd0e2b911e27dc8a0f
|
|
7
|
+
data.tar.gz: e1caa07d54fe23a2f2ea1b90809371a53bfd791eba6751bab9b65dac254c7f7935cf54f4b217adb68e084abd478192000090c91005d644188f64e2d7930264fd
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Ductwork Changelog
|
|
2
2
|
|
|
3
|
+
## [0.8.1]
|
|
4
|
+
|
|
5
|
+
- fix: properly wrap "units of work" in rails application executor in pipeline advancer
|
|
6
|
+
- fix: remove wrapping thread creation with the rails application executor - these threads are long-running so they should not be wrapped; later commits will wrap each individual "unit of work" with the executor as recommended
|
|
7
|
+
- fix: move pipeline advancer creation into thread initialization block - this effectively doesn't change anything but is useful in case we need to do something on the advancer thread in the initializer
|
|
8
|
+
- fix: move job worker creation into thread initialization block - this effectively doesn't change anything but is useful in case we need to do something on the worker thread in the initializer
|
|
9
|
+
|
|
3
10
|
## [0.8.0]
|
|
4
11
|
|
|
5
12
|
- chore: re-organize `Ductwork::CLI` class
|
data/LICENSE.txt
CHANGED
|
@@ -4,7 +4,7 @@ the LGPLv3.0 license. Please see below for license text:
|
|
|
4
4
|
GNU LESSER GENERAL PUBLIC LICENSE
|
|
5
5
|
Version 3, 29 June 2007
|
|
6
6
|
|
|
7
|
-
Copyright (c) 2024-2025
|
|
7
|
+
Copyright (c) 2024-2025 Pen and Paper Solutions LLC
|
|
8
8
|
Everyone is permitted to copy and distribute verbatim copies
|
|
9
9
|
of this license document, but changing it is not allowed.
|
|
10
10
|
|
|
@@ -51,17 +51,15 @@ module Ductwork
|
|
|
51
51
|
|
|
52
52
|
def create_threads
|
|
53
53
|
worker_count.times.map do |i|
|
|
54
|
-
job_worker = Ductwork::Processes::JobWorker.new(
|
|
55
|
-
pipeline,
|
|
56
|
-
running_context
|
|
57
|
-
)
|
|
58
54
|
Ductwork.logger.debug(
|
|
59
55
|
msg: "Creating new thread",
|
|
60
56
|
role: :job_worker_runner,
|
|
61
57
|
pipeline: pipeline
|
|
62
58
|
)
|
|
63
59
|
thread = Thread.new do
|
|
64
|
-
|
|
60
|
+
Ductwork::Processes::JobWorker
|
|
61
|
+
.new(pipeline, running_context)
|
|
62
|
+
.run
|
|
65
63
|
end
|
|
66
64
|
thread.name = "ductwork.job_worker.#{i}"
|
|
67
65
|
|
|
@@ -10,8 +10,9 @@ module Ductwork
|
|
|
10
10
|
|
|
11
11
|
def run # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
|
|
12
12
|
run_hooks_for(:start)
|
|
13
|
+
|
|
13
14
|
while running_context.running?
|
|
14
|
-
id = Ductwork
|
|
15
|
+
id = Ductwork.wrap_with_app_executor do
|
|
15
16
|
Ductwork::Pipeline
|
|
16
17
|
.in_progress
|
|
17
18
|
.where(klass: klass, claimed_for_advancing_at: nil)
|
|
@@ -24,12 +25,14 @@ module Ductwork
|
|
|
24
25
|
end
|
|
25
26
|
|
|
26
27
|
if id.present?
|
|
27
|
-
rows_updated = Ductwork
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
rows_updated = Ductwork.wrap_with_app_executor do
|
|
29
|
+
Ductwork::Pipeline
|
|
30
|
+
.where(id: id, claimed_for_advancing_at: nil)
|
|
31
|
+
.update_all(
|
|
32
|
+
claimed_for_advancing_at: Time.current,
|
|
33
|
+
status: "advancing"
|
|
34
|
+
)
|
|
35
|
+
end
|
|
33
36
|
|
|
34
37
|
if rows_updated == 1
|
|
35
38
|
Ductwork.logger.debug(
|
|
@@ -39,23 +42,31 @@ module Ductwork
|
|
|
39
42
|
role: :pipeline_advancer
|
|
40
43
|
)
|
|
41
44
|
|
|
42
|
-
pipeline = Ductwork
|
|
43
|
-
|
|
45
|
+
pipeline = Ductwork.wrap_with_app_executor do
|
|
46
|
+
pipeline = Ductwork::Pipeline.find(id)
|
|
47
|
+
pipeline.advance!
|
|
44
48
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
Ductwork.logger.debug(
|
|
50
|
+
msg: "Pipeline advanced",
|
|
51
|
+
pipeline_id: id,
|
|
52
|
+
pipeline: klass,
|
|
53
|
+
role: :pipeline_advancer
|
|
54
|
+
)
|
|
51
55
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
# rubocop:todo Metrics/BlockNesting
|
|
57
|
+
status = pipeline.completed? ? "completed" : "in_progress"
|
|
58
|
+
# rubocop:enable Metrics/BlockNesting
|
|
59
|
+
|
|
60
|
+
# release the pipeline and set last advanced at so it doesn't
|
|
61
|
+
# block. we're not using a queue so we have to use a db
|
|
62
|
+
# timestamp
|
|
63
|
+
ensure
|
|
64
|
+
pipeline.update!(
|
|
65
|
+
claimed_for_advancing_at: nil,
|
|
66
|
+
last_advanced_at: Time.current,
|
|
67
|
+
status: status
|
|
68
|
+
)
|
|
69
|
+
end
|
|
59
70
|
else
|
|
60
71
|
Ductwork.logger.debug(
|
|
61
72
|
msg: "Did not claim pipeline, avoided race condition",
|
|
@@ -46,20 +46,15 @@ module Ductwork
|
|
|
46
46
|
|
|
47
47
|
def create_threads
|
|
48
48
|
klasses.map do |klass|
|
|
49
|
-
pipeline_advancer = Ductwork::Processes::PipelineAdvancer.new(
|
|
50
|
-
running_context,
|
|
51
|
-
klass
|
|
52
|
-
)
|
|
53
|
-
|
|
54
49
|
Ductwork.logger.debug(
|
|
55
50
|
msg: "Creating new thread",
|
|
56
51
|
role: :pipeline_advancer_runner,
|
|
57
52
|
pipeline: klass
|
|
58
53
|
)
|
|
59
54
|
thread = Thread.new do
|
|
60
|
-
Ductwork
|
|
61
|
-
|
|
62
|
-
|
|
55
|
+
Ductwork::Processes::PipelineAdvancer
|
|
56
|
+
.new(running_context, klass)
|
|
57
|
+
.run
|
|
63
58
|
end
|
|
64
59
|
thread.name = "ductwork.pipeline_advancer.#{klass}"
|
|
65
60
|
|
data/lib/ductwork/version.rb
CHANGED