ductwork 0.11.1 → 0.12.0
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/CHANGELOG.md +17 -0
- data/lib/ductwork/dsl/definition_builder.rb +0 -1
- data/lib/ductwork/models/job.rb +3 -3
- data/lib/ductwork/models/pipeline.rb +23 -9
- data/lib/ductwork/processes/job_worker.rb +3 -3
- data/lib/ductwork/processes/job_worker_runner.rb +2 -2
- data/lib/ductwork/processes/pipeline_advancer.rb +2 -3
- data/lib/ductwork/processes/pipeline_advancer_runner.rb +1 -1
- data/lib/ductwork/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f31c4b527238da8b5025cad05246c99ad197fa2dd3302ebc5523e58ecbddaf5e
|
|
4
|
+
data.tar.gz: 111a5c0e4a4b45ec0c6bed50698e25eeaca9947601220f45378f1e2eb9a2f7e2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '095e1453247f76378f960080fa87031a307da13b01de64e78da4d07598ae0f4da997c49f7801c4fbe6101512c235d4eb1208922e09d3acbd29ec8f2817fa197f'
|
|
7
|
+
data.tar.gz: 8f6606e82a50cbc6d847d3406d30ce18db1bf586a46dd1a44f86e80866cd9aed5ce444aa994933062e7af1d6d174c6d9c489f9cd82f6e62d96ede8357bba42cf
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Ductwork Changelog
|
|
2
2
|
|
|
3
|
+
## [0.12.0]
|
|
4
|
+
|
|
5
|
+
- chore: replace usages of `Pipeline#halted!` with `Pipeline#halt!`
|
|
6
|
+
- feat: create `Ductwork::Pipeline#halt!` method
|
|
7
|
+
- chore: extract `Ductwork::Pipeline#complete!` method
|
|
8
|
+
|
|
9
|
+
## [0.11.2]
|
|
10
|
+
|
|
11
|
+
- fix: join error backtrace lines before persisting in `text` column
|
|
12
|
+
- fix: use computed `max_retry` when determining job retry
|
|
13
|
+
- fix: protect against a possible null `status` when advancing a pipeline
|
|
14
|
+
- fix: correct spelling of `last_heartbeat_at` variable
|
|
15
|
+
- fix: flip inverted deadline check in job worker runner
|
|
16
|
+
- fix: flip inverted deadline check in pipeline advancer runner
|
|
17
|
+
- fix: reference `thread` variable from `job_worker`, not top-level
|
|
18
|
+
- fix: remove unnecessary, erroneous line in definition builder
|
|
19
|
+
|
|
3
20
|
## [0.11.1]
|
|
4
21
|
|
|
5
22
|
- fix: use info-level for job worker restart log messages
|
data/lib/ductwork/models/job.rb
CHANGED
|
@@ -163,7 +163,7 @@ module Ductwork
|
|
|
163
163
|
result_type: "failure",
|
|
164
164
|
error_klass: error.class.to_s,
|
|
165
165
|
error_message: error.message,
|
|
166
|
-
error_backtrace: error.backtrace
|
|
166
|
+
error_backtrace: error.backtrace.join("\n")
|
|
167
167
|
)
|
|
168
168
|
|
|
169
169
|
if execution.retry_count < max_retry
|
|
@@ -174,11 +174,11 @@ module Ductwork
|
|
|
174
174
|
new_execution.create_availability!(
|
|
175
175
|
started_at: FAILED_EXECUTION_TIMEOUT.from_now
|
|
176
176
|
)
|
|
177
|
-
elsif execution.retry_count >=
|
|
177
|
+
elsif execution.retry_count >= max_retry
|
|
178
178
|
halted = true
|
|
179
179
|
|
|
180
180
|
step.update!(status: :failed)
|
|
181
|
-
pipeline.
|
|
181
|
+
pipeline.halt!
|
|
182
182
|
end
|
|
183
183
|
end
|
|
184
184
|
|
|
@@ -114,6 +114,26 @@ module Ductwork
|
|
|
114
114
|
@parsed_definition ||= JSON.parse(definition).with_indifferent_access
|
|
115
115
|
end
|
|
116
116
|
|
|
117
|
+
def complete!
|
|
118
|
+
update!(status: :completed, completed_at: Time.current)
|
|
119
|
+
|
|
120
|
+
Ductwork.logger.info(
|
|
121
|
+
msg: "Pipeline completed",
|
|
122
|
+
pipeline_id: id,
|
|
123
|
+
role: :pipeline_advancer
|
|
124
|
+
)
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def halt!
|
|
128
|
+
halted!
|
|
129
|
+
|
|
130
|
+
Ductwork.logger.info(
|
|
131
|
+
msg: "Pipeline halted",
|
|
132
|
+
pipeline_id: id,
|
|
133
|
+
pipeline_klass: klass
|
|
134
|
+
)
|
|
135
|
+
end
|
|
136
|
+
|
|
117
137
|
private
|
|
118
138
|
|
|
119
139
|
def create_step_and_enqueue_job(edge:, input_arg:, node: nil)
|
|
@@ -148,13 +168,7 @@ module Ductwork
|
|
|
148
168
|
.exists?
|
|
149
169
|
|
|
150
170
|
if !remaining
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
Ductwork.logger.info(
|
|
154
|
-
msg: "Pipeline completed",
|
|
155
|
-
pipeline_id: id,
|
|
156
|
-
role: :pipeline_advancer
|
|
157
|
-
)
|
|
171
|
+
complete!
|
|
158
172
|
end
|
|
159
173
|
end
|
|
160
174
|
|
|
@@ -205,7 +219,7 @@ module Ductwork
|
|
|
205
219
|
end
|
|
206
220
|
|
|
207
221
|
if too_many
|
|
208
|
-
|
|
222
|
+
halt!
|
|
209
223
|
else
|
|
210
224
|
edge[:to].each do |node|
|
|
211
225
|
input_arg = Ductwork::Job.find_by(step_id:).return_value
|
|
@@ -251,7 +265,7 @@ module Ductwork
|
|
|
251
265
|
max_depth = Ductwork.configuration.steps_max_depth(pipeline: klass, step: next_klass)
|
|
252
266
|
|
|
253
267
|
if max_depth != -1 && return_value.count > max_depth
|
|
254
|
-
|
|
268
|
+
halt!
|
|
255
269
|
else
|
|
256
270
|
Array(return_value).each do |input_arg|
|
|
257
271
|
create_step_and_enqueue_job(edge:, input_arg:)
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
module Ductwork
|
|
4
4
|
module Processes
|
|
5
5
|
class JobWorker
|
|
6
|
-
attr_reader :thread, :
|
|
6
|
+
attr_reader :thread, :last_heartbeat_at, :job
|
|
7
7
|
|
|
8
8
|
def initialize(pipeline, id)
|
|
9
9
|
@pipeline = pipeline
|
|
10
10
|
@id = id
|
|
11
11
|
@running_context = Ductwork::RunningContext.new
|
|
12
12
|
@thread = nil
|
|
13
|
-
@
|
|
13
|
+
@last_heartbeat_at = Time.current
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
def start
|
|
@@ -67,7 +67,7 @@ module Ductwork
|
|
|
67
67
|
sleep(polling_timeout)
|
|
68
68
|
end
|
|
69
69
|
|
|
70
|
-
@
|
|
70
|
+
@last_heartbeat_at = Time.current
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
Ductwork.logger.debug(
|
|
@@ -126,7 +126,7 @@ module Ductwork
|
|
|
126
126
|
|
|
127
127
|
while Time.current < deadline && job_workers.any?(&:alive?)
|
|
128
128
|
job_workers.each do |job_worker|
|
|
129
|
-
break if Time.current
|
|
129
|
+
break if Time.current > deadline
|
|
130
130
|
|
|
131
131
|
# TODO: Maybe make this configurable. If there's a ton of workers
|
|
132
132
|
# it may not even get to the "later" ones depending on the timeout
|
|
@@ -142,7 +142,7 @@ module Ductwork
|
|
|
142
142
|
Ductwork.logger.debug(
|
|
143
143
|
msg: "Killed thread",
|
|
144
144
|
role: :job_worker_runner,
|
|
145
|
-
thread: thread.name
|
|
145
|
+
thread: job_worker.thread.name
|
|
146
146
|
)
|
|
147
147
|
end
|
|
148
148
|
end
|
|
@@ -56,15 +56,14 @@ module Ductwork
|
|
|
56
56
|
# rubocop:todo Metrics/BlockNesting
|
|
57
57
|
status = pipeline.completed? ? "completed" : "in_progress"
|
|
58
58
|
# rubocop:enable Metrics/BlockNesting
|
|
59
|
-
|
|
59
|
+
ensure
|
|
60
60
|
# release the pipeline and set last advanced at so it doesn't
|
|
61
61
|
# block. we're not using a queue so we have to use a db
|
|
62
62
|
# timestamp
|
|
63
|
-
ensure
|
|
64
63
|
pipeline.update!(
|
|
65
64
|
claimed_for_advancing_at: nil,
|
|
66
65
|
last_advanced_at: Time.current,
|
|
67
|
-
status: status
|
|
66
|
+
status: status || "in_progress"
|
|
68
67
|
)
|
|
69
68
|
end
|
|
70
69
|
else
|
|
@@ -125,7 +125,7 @@ module Ductwork
|
|
|
125
125
|
)
|
|
126
126
|
while Time.current < deadline && threads.any?(&:alive?)
|
|
127
127
|
threads.each do |thread|
|
|
128
|
-
break if Time.current
|
|
128
|
+
break if Time.current > deadline
|
|
129
129
|
|
|
130
130
|
# TODO: Maybe make this configurable. If there's a ton of workers
|
|
131
131
|
# it may not even get to the "later" ones depending on the timeout
|
data/lib/ductwork/version.rb
CHANGED