ductwork 1.1.1 → 1.2.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-PRO.md +14 -1
- data/CHANGELOG.md +10 -0
- data/lib/ductwork/engine.rb +0 -1
- data/lib/ductwork/migration_helper.rb +23 -0
- data/lib/ductwork/models/execution.rb +1 -1
- data/lib/ductwork/models/step.rb +6 -7
- data/lib/ductwork/version.rb +1 -1
- data/lib/ductwork.rb +6 -2
- data/lib/generators/ductwork/install/templates/db/create_ductwork_availabilities.rb +1 -10
- data/lib/generators/ductwork/update/templates/db/denormalize_pipeline_klass_on_availabilities.rb +2 -12
- 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: 402e7de6f5703214be13a443e54a5b74f113500a22ad42727db969a7bcb39b69
|
|
4
|
+
data.tar.gz: 9889dd598476068548da0f6cf9e63cf94f72e6e124b837d3abe2994de6a2770f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2eb520b852ff56484b7afd3f89a525f4e444ba2a04a03ff3d97152bdad625cf5d393a2500a72bcdd2ca8a4122f726caaadcd8aa4c626e70e8ba6397ec84bd5df
|
|
7
|
+
data.tar.gz: 8667ad5225297be4b5c98383fbe0ad3766e18a33391912d110e9aae94bcaa5c9949089fb2c8f4eb0d6f0f17c8588626e82e6c7abe90aa0293a2081dffe8aef82
|
data/CHANGELOG-PRO.md
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
# Ductwork Pro Changelog
|
|
2
2
|
|
|
3
|
-
## [1.1.
|
|
3
|
+
## [1.1.2]
|
|
4
4
|
|
|
5
|
+
- fix: remove unnecessary setting of configuration object during class-level evaluation - this catches up with OSS changes
|
|
6
|
+
- fix: pass extra step id argument when instantiating steps during execution - this catches up with current OSS changes
|
|
7
|
+
|
|
8
|
+
## [1.1.1]
|
|
9
|
+
|
|
10
|
+
- fix: use `Ductwork::DatabaseClock` instead of `Time.current` for every `started_at` Pro stamps, mirroring the OSS fix
|
|
11
|
+
- fix: evaluate the step-timeout deadline in the database (`DatabaseClock.ago_sql`) instead of subtracting `attempt.started_at` from the worker's `Time.current`, so an NTP correction mid-job cannot stretch or collapse a step's timeout
|
|
12
|
+
- fix: temporarily handle multiple return types from `Branch.with_latest_claimed` - this is a result of changes in OSS from v1.1.0 and v1.1.1
|
|
13
|
+
- fix: log the claimed job/branch of a dead thread before the restart clears it
|
|
14
|
+
- fix: add rubocop cop for ensuring `updated_at` is updated (copied from OSS)
|
|
15
|
+
- fix: explicitly set `updated_at` for queries that update the record directly
|
|
16
|
+
- fix: mirror OSS `halt_branch_and_resolve_run_without_rescue!` implementation
|
|
17
|
+
- fix: walk the `collapse` fan-in with an explicit keyset scan so each batch is one indexed range seek, instead of a per-batch subquery plus a second `in_batches` query that re-ran the whole scope
|
|
5
18
|
- fix: don't use `unique_by` argument for `insert_all` for mysql and trilogy database adapters
|
|
6
19
|
|
|
7
20
|
## [1.1.0]
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Ductwork Changelog
|
|
2
2
|
|
|
3
|
+
## [1.2.0]
|
|
4
|
+
|
|
5
|
+
- feat: add `add_availability_claim_index` and `remove_availability_claim_index` to `Ductwork::MigrationHelper`, which own the adapter-specific shape and the name of the availability claim index
|
|
6
|
+
- chore: build the availability claim index through the new migration helpers
|
|
7
|
+
|
|
8
|
+
## [1.1.2]
|
|
9
|
+
|
|
10
|
+
- fix: lazily create configuration
|
|
11
|
+
- fix: prevent step's idempotency key from returning `nil`
|
|
12
|
+
|
|
3
13
|
## [1.1.1]
|
|
4
14
|
|
|
5
15
|
- fix: use database clock instead of `Time.current` to avoid clock skew in `Branch#latest_step` paths
|
data/lib/ductwork/engine.rb
CHANGED
|
@@ -2,6 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
module Ductwork
|
|
4
4
|
module MigrationHelper
|
|
5
|
+
AVAILABILITY_CLAIM_INDEX_NAME = "index_ductwork_availabilities_on_claim_latest"
|
|
6
|
+
|
|
7
|
+
def add_availability_claim_index(extra_columns: [], where_extra: nil)
|
|
8
|
+
if mysql?
|
|
9
|
+
add_index :ductwork_availabilities,
|
|
10
|
+
[:pipeline_klass, :completed_at, *extra_columns, :started_at],
|
|
11
|
+
name: AVAILABILITY_CLAIM_INDEX_NAME
|
|
12
|
+
else
|
|
13
|
+
predicate = ["completed_at IS NULL", where_extra].compact.join(" AND ")
|
|
14
|
+
|
|
15
|
+
add_index :ductwork_availabilities,
|
|
16
|
+
%i[pipeline_klass started_at],
|
|
17
|
+
name: AVAILABILITY_CLAIM_INDEX_NAME,
|
|
18
|
+
where: predicate
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def remove_availability_claim_index
|
|
23
|
+
remove_index :ductwork_availabilities,
|
|
24
|
+
name: AVAILABILITY_CLAIM_INDEX_NAME,
|
|
25
|
+
if_exists: true
|
|
26
|
+
end
|
|
27
|
+
|
|
5
28
|
def create_ductwork_table(table_name, &block)
|
|
6
29
|
if postgresql?
|
|
7
30
|
create_table table_name, id: :uuid, &block
|
|
@@ -29,7 +29,7 @@ module Ductwork
|
|
|
29
29
|
job_klass: job.klass
|
|
30
30
|
)
|
|
31
31
|
args = JSON.parse(job.input_args)["args"]
|
|
32
|
-
instance = Object.const_get(job.klass).build_for_execution(job.step.run_id, *args)
|
|
32
|
+
instance = Object.const_get(job.klass).build_for_execution(job.step.run_id, job.step.id, *args)
|
|
33
33
|
create_attempt!(started_at: Time.current)
|
|
34
34
|
output_payload = nil
|
|
35
35
|
|
data/lib/ductwork/models/step.rb
CHANGED
|
@@ -40,23 +40,22 @@ module Ductwork
|
|
|
40
40
|
converge: "converge",
|
|
41
41
|
dampen: "dampen"
|
|
42
42
|
|
|
43
|
-
def self.build_for_execution(run_id, *, **)
|
|
43
|
+
def self.build_for_execution(run_id, idempotency_key, *, **)
|
|
44
44
|
instance = allocate
|
|
45
45
|
instance.instance_variable_set(:@run_id, run_id)
|
|
46
|
+
instance.instance_variable_set(:@idempotency_key, idempotency_key)
|
|
46
47
|
instance.send(:initialize, *, **)
|
|
47
48
|
instance
|
|
48
49
|
end
|
|
49
50
|
|
|
50
|
-
alias_attribute :idempotency_key, :id
|
|
51
|
-
|
|
52
51
|
def run_id
|
|
53
52
|
@run_id || (@attributes && super)
|
|
54
53
|
end
|
|
55
54
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
def idempotency_key
|
|
56
|
+
@idempotency_key || (@attributes && id)
|
|
57
|
+
end
|
|
58
|
+
|
|
60
59
|
def terminal_result_type
|
|
61
60
|
return if job.blank?
|
|
62
61
|
|
data/lib/ductwork/version.rb
CHANGED
data/lib/ductwork.rb
CHANGED
|
@@ -11,8 +11,12 @@ require "zeitwerk"
|
|
|
11
11
|
|
|
12
12
|
module Ductwork
|
|
13
13
|
class << self
|
|
14
|
-
attr_accessor :app_executor, :
|
|
15
|
-
attr_writer :defined_pipelines, :hooks
|
|
14
|
+
attr_accessor :app_executor, :loader, :logger
|
|
15
|
+
attr_writer :configuration, :defined_pipelines, :hooks
|
|
16
|
+
|
|
17
|
+
def configuration
|
|
18
|
+
@configuration ||= Ductwork::Configuration.new
|
|
19
|
+
end
|
|
16
20
|
|
|
17
21
|
def eager_load
|
|
18
22
|
loader.eager_load
|
|
@@ -26,15 +26,6 @@ class CreateDuctworkAvailabilities < Ductwork::Migration
|
|
|
26
26
|
add_index :ductwork_availabilities, :execution_id, unique: true
|
|
27
27
|
add_index :ductwork_availabilities, %i[id process_id]
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
add_index :ductwork_availabilities,
|
|
31
|
-
%i[pipeline_klass completed_at started_at],
|
|
32
|
-
name: "index_ductwork_availabilities_on_claim_latest"
|
|
33
|
-
else
|
|
34
|
-
add_index :ductwork_availabilities,
|
|
35
|
-
%i[pipeline_klass started_at],
|
|
36
|
-
name: "index_ductwork_availabilities_on_claim_latest",
|
|
37
|
-
where: "completed_at IS NULL"
|
|
38
|
-
end
|
|
29
|
+
add_availability_claim_index
|
|
39
30
|
end
|
|
40
31
|
end
|
data/lib/generators/ductwork/update/templates/db/denormalize_pipeline_klass_on_availabilities.rb
CHANGED
|
@@ -11,17 +11,7 @@ class DenormalizePipelineKlassOnAvailabilities < Ductwork::Migration
|
|
|
11
11
|
.update_all(pipeline_klass: "Pipeline")
|
|
12
12
|
|
|
13
13
|
change_column_null :ductwork_availabilities, :pipeline_klass, false
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if mysql?
|
|
17
|
-
add_index :ductwork_availabilities,
|
|
18
|
-
%i[pipeline_klass completed_at started_at],
|
|
19
|
-
name: "index_ductwork_availabilities_on_claim_latest"
|
|
20
|
-
else
|
|
21
|
-
add_index :ductwork_availabilities,
|
|
22
|
-
%i[pipeline_klass started_at],
|
|
23
|
-
name: "index_ductwork_availabilities_on_claim_latest",
|
|
24
|
-
where: "completed_at IS NULL"
|
|
25
|
-
end
|
|
14
|
+
remove_availability_claim_index
|
|
15
|
+
add_availability_claim_index
|
|
26
16
|
end
|
|
27
17
|
end
|