acidic_job 1.0.0.pre23 → 1.0.0.pre24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/acidic_job/awaiting.rb +3 -4
- data/lib/acidic_job/extensions/sidekiq.rb +1 -1
- data/lib/acidic_job/run.rb +9 -6
- data/lib/acidic_job/staging.rb +0 -9
- data/lib/acidic_job/version.rb +1 -1
- data/lib/acidic_job.rb +0 -4
- 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: 223aa8cad5d48e2a4fc04a9e33f82bdf7ef54cb933c2e14f3dc0aa6d46986932
|
4
|
+
data.tar.gz: a8a646da8f9e5987267f1448e44056bdd37c2d4f8cbfbc84650659555567b635
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 857647ff5cce856d41a8e30014005ef035cefcca383a719e6e679a4fc7bdc254c76f65e2d312c508ad56fd45b1e33ed533aecf2541e13b0480c579e0127ec338
|
7
|
+
data.tar.gz: 4208fa26057e5a1fb0908c554b8e2ef74c6a5018a4d782815caa1fbd7716f18b33598ff6877e3c0c583f449099438d316c506dee6fa84afea34d54aa42f085b8
|
data/Gemfile.lock
CHANGED
data/lib/acidic_job/awaiting.rb
CHANGED
@@ -32,11 +32,10 @@ module AcidicJob
|
|
32
32
|
|
33
33
|
return if run.finished?
|
34
34
|
|
35
|
-
# job = job_class.constantize.deserialize(serialized_staged_job)
|
36
|
-
# job.enqueue
|
37
|
-
|
38
35
|
# when a batch of jobs for a step succeeds, we begin processing the `AcidicJob::Run` record again
|
39
|
-
process_run(run)
|
36
|
+
# process_run(run)
|
37
|
+
run.update_column(:locked_at, nil)
|
38
|
+
job.enqueue
|
40
39
|
end
|
41
40
|
|
42
41
|
def enqueue_step_parallel_jobs(jobs_or_jobs_getter, run, step_result)
|
data/lib/acidic_job/run.rb
CHANGED
@@ -64,16 +64,19 @@ module AcidicJob
|
|
64
64
|
error_object.present?
|
65
65
|
end
|
66
66
|
|
67
|
-
|
68
|
-
|
69
|
-
def enqueue_staged_job
|
70
|
-
return unless staged?
|
71
|
-
|
67
|
+
def staged_job_id
|
72
68
|
# encode the identifier for this record in the job ID
|
73
69
|
# base64 encoding for minimal security
|
74
70
|
global_id = to_global_id.to_s.remove("gid://")
|
75
71
|
encoded_global_id = Base64.encode64(global_id).strip
|
76
|
-
|
72
|
+
|
73
|
+
"STG__#{idempotency_key}__#{encoded_global_id}"
|
74
|
+
end
|
75
|
+
|
76
|
+
private
|
77
|
+
|
78
|
+
def enqueue_staged_job
|
79
|
+
return unless staged?
|
77
80
|
|
78
81
|
serialized_staged_job = if serialized_job.key?("jid")
|
79
82
|
serialized_job.merge("jid" => staged_job_id)
|
data/lib/acidic_job/staging.rb
CHANGED
@@ -9,15 +9,6 @@ module AcidicJob
|
|
9
9
|
|
10
10
|
private
|
11
11
|
|
12
|
-
def delete_staged_job_record
|
13
|
-
return unless was_staged_job?
|
14
|
-
|
15
|
-
staged_job_run.delete
|
16
|
-
true
|
17
|
-
rescue ActiveRecord::RecordNotFound
|
18
|
-
true
|
19
|
-
end
|
20
|
-
|
21
12
|
def was_staged_job?
|
22
13
|
identifier.start_with? "STG__"
|
23
14
|
end
|
data/lib/acidic_job/version.rb
CHANGED
data/lib/acidic_job.rb
CHANGED
@@ -50,13 +50,9 @@ module AcidicJob
|
|
50
50
|
# TODO: write test for a staged job that uses awaits
|
51
51
|
klass.set_callback :perform, :after, :reenqueue_awaited_by_job,
|
52
52
|
if: -> { was_awaited_job? && !was_workflow_job? }
|
53
|
-
klass.set_callback :perform, :after, :delete_staged_job_record,
|
54
|
-
if: -> { was_staged_job? && !was_awaited_job? }
|
55
53
|
klass.define_callbacks :finish
|
56
54
|
klass.set_callback :finish, :after, :reenqueue_awaited_by_job,
|
57
55
|
if: -> { was_workflow_job? && was_awaited_job? }
|
58
|
-
klass.set_callback :finish, :after, :delete_staged_job_record,
|
59
|
-
if: -> { was_workflow_job? && was_staged_job? && !was_awaited_job? }
|
60
56
|
|
61
57
|
klass.instance_variable_set(:@acidic_identifier, :job_id)
|
62
58
|
klass.define_singleton_method(:acidic_by_job_id) { @acidic_identifier = :job_id }
|