ductwork 0.6.1 → 0.7.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 +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/ductwork/dsl/definition_builder.rb +2 -3
- data/lib/ductwork/models/job.rb +21 -8
- 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: 6174d886b38c9a000eda9937e27efabd0f89a803c5c77fb5739c2b67d8c004c9
|
|
4
|
+
data.tar.gz: 6300c6f3d238e2f92aa74c5ebe01c37bcbf842693f186b9c56e8d8b2cbcf567d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fcda67f0378eb7e4108820ce87ac4b508698abcd02e71ef77b7ec8442dfeeea019a77e35bacba5a32fda4101004d2c0f349441d3921838deee97aea6ac93eed5
|
|
7
|
+
data.tar.gz: e74fef5cf5bbf80b8b112616636a556a6ec7742ade2fe44dae3679b3c679ef7b9eb96dc81ad016fb1d4285a06cef874f74d1f6c67a20062b5eaa0bdcfde6061c
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Ductwork Changelog
|
|
2
2
|
|
|
3
|
+
## [0.7.1]
|
|
4
|
+
|
|
5
|
+
- chore: isolate on halt execution in `Ductwork::Job#execution_failed!`
|
|
6
|
+
- chore: add pipeline definition metadata to `DefinitionBuilder` initializer
|
|
7
|
+
|
|
8
|
+
## [0.7.0]
|
|
9
|
+
|
|
10
|
+
- feat: set `Pipeline` and `Step` models status to "in-progress" when claiming latest job
|
|
11
|
+
|
|
3
12
|
## [0.6.1]
|
|
4
13
|
|
|
5
14
|
- chore: update misc development dependencies
|
|
@@ -9,6 +9,7 @@ module Ductwork
|
|
|
9
9
|
|
|
10
10
|
def initialize
|
|
11
11
|
@definition = {
|
|
12
|
+
metadata: {},
|
|
12
13
|
nodes: [],
|
|
13
14
|
edges: {},
|
|
14
15
|
}
|
|
@@ -102,9 +103,7 @@ module Ductwork
|
|
|
102
103
|
def on_halt(klass)
|
|
103
104
|
validate_classes!(klass)
|
|
104
105
|
|
|
105
|
-
definition[:metadata]
|
|
106
|
-
definition[:metadata][:on_halt] = {}
|
|
107
|
-
definition[:metadata][:on_halt][:klass] = klass.name
|
|
106
|
+
definition[:metadata][:on_halt] = { klass: klass.name }
|
|
108
107
|
|
|
109
108
|
self
|
|
110
109
|
end
|
data/lib/ductwork/models/job.rb
CHANGED
|
@@ -11,7 +11,7 @@ module Ductwork
|
|
|
11
11
|
|
|
12
12
|
FAILED_EXECUTION_TIMEOUT = 10.seconds
|
|
13
13
|
|
|
14
|
-
def self.claim_latest(klass) # rubocop:todo Metrics
|
|
14
|
+
def self.claim_latest(klass) # rubocop:todo Metrics
|
|
15
15
|
process_id = ::Process.pid
|
|
16
16
|
id = Ductwork::Availability
|
|
17
17
|
.joins(execution: { job: { step: :pipeline } })
|
|
@@ -45,9 +45,16 @@ module Ductwork
|
|
|
45
45
|
process_id: process_id,
|
|
46
46
|
availability_id: id
|
|
47
47
|
)
|
|
48
|
-
Ductwork::Job
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
job = Ductwork::Job
|
|
49
|
+
.joins(executions: :availability)
|
|
50
|
+
.find_by(ductwork_availabilities: { id:, process_id: })
|
|
51
|
+
|
|
52
|
+
Ductwork::Record.transaction do
|
|
53
|
+
job.step.in_progress!
|
|
54
|
+
job.step.pipeline.in_progress!
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
job
|
|
51
58
|
else
|
|
52
59
|
Ductwork.logger.debug(
|
|
53
60
|
msg: "Did not claim job, avoided race condition",
|
|
@@ -188,11 +195,17 @@ module Ductwork
|
|
|
188
195
|
# NOTE: perform lifecycle hook execution outside of the transaction as
|
|
189
196
|
# to not unnecessarily hold it open
|
|
190
197
|
if halted
|
|
191
|
-
|
|
198
|
+
execute_on_halt(pipeline, error)
|
|
199
|
+
end
|
|
200
|
+
end
|
|
192
201
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
202
|
+
def execute_on_halt(pipeline, error)
|
|
203
|
+
klass = JSON
|
|
204
|
+
.parse(pipeline.definition)
|
|
205
|
+
.dig("metadata", "on_halt", "klass")
|
|
206
|
+
|
|
207
|
+
if klass.present?
|
|
208
|
+
Object.const_get(klass).new(error).execute
|
|
196
209
|
end
|
|
197
210
|
end
|
|
198
211
|
end
|
data/lib/ductwork/version.rb
CHANGED