acidic_job 1.0.0.beta.6 → 1.0.0.beta.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +13 -0
- data/Gemfile.lock +1 -1
- data/lib/acidic_job/mixin.rb +1 -1
- data/lib/acidic_job/processor.rb +7 -8
- data/lib/acidic_job/run.rb +5 -1
- data/lib/acidic_job/test_case.rb +9 -0
- data/lib/acidic_job/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55e96056c881f1a048efc79156db98799bd911ac8417803260499ef1d9f69ff7
|
4
|
+
data.tar.gz: 52ae51638b01352db67279455f08b086c2be8c725914fe32c84542d9b5927325
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b6a2f319942e8f5973255453608edab836b8e02c421ab3291725b171817f100061319b0fed5af60a706ae8b4eabc15f3b62f146eeff0a97474fa817547a53ff
|
7
|
+
data.tar.gz: 6fa11549153a9334089a59534e049e59fba1a5f353069d49ec347238f3e6f26b18b0deb618414e99b33a33400554d05b0ebc29389c12ce1c0e5cb5c727ef90c1
|
data/.github/FUNDING.yml
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# These are supported funding model platforms
|
2
|
+
|
3
|
+
github: fractaledmind
|
4
|
+
patreon: # Replace with a single Patreon username
|
5
|
+
open_collective: # Replace with a single Open Collective username
|
6
|
+
ko_fi: # Replace with a single Ko-fi username
|
7
|
+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
8
|
+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
9
|
+
liberapay: # Replace with a single Liberapay username
|
10
|
+
issuehunt: # Replace with a single IssueHunt username
|
11
|
+
otechie: # Replace with a single Otechie username
|
12
|
+
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
13
|
+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
data/Gemfile.lock
CHANGED
data/lib/acidic_job/mixin.rb
CHANGED
@@ -227,7 +227,7 @@ module AcidicJob
|
|
227
227
|
|
228
228
|
# "STG__#{idempotency_key}__#{encoded_global_id}"
|
229
229
|
_prefix, _idempotency_key, encoded_global_id = job_id.split("__")
|
230
|
-
staged_job_gid = "gid://#{::Base64.
|
230
|
+
staged_job_gid = "gid://#{::Base64.urlsafe_decode64(encoded_global_id)}"
|
231
231
|
|
232
232
|
@staged_job_run = ::GlobalID::Locator.locate(staged_job_gid)
|
233
233
|
end
|
data/lib/acidic_job/processor.rb
CHANGED
@@ -19,7 +19,7 @@ module AcidicJob
|
|
19
19
|
if !@run.known_recovery_point?
|
20
20
|
raise UnknownRecoveryPoint,
|
21
21
|
"Defined workflow does not reference this step: #{@run.current_step_name.inspect}"
|
22
|
-
elsif
|
22
|
+
elsif (awaited_jobs = jobs_from(@run.current_step_awaits)).any?
|
23
23
|
# We only execute the current step, without progressing to the next step.
|
24
24
|
# This ensures that any failures in parallel jobs will have this step retried in the main workflow
|
25
25
|
step_result = @workflow.execute_current_step
|
@@ -47,14 +47,12 @@ module AcidicJob
|
|
47
47
|
|
48
48
|
private
|
49
49
|
|
50
|
-
def enqueue_awaited_jobs(
|
51
|
-
awaited_jobs = jobs_from(jobs_or_jobs_getter)
|
52
|
-
|
50
|
+
def enqueue_awaited_jobs(awaited_jobs, step_result)
|
53
51
|
AcidicJob.logger.log_run_event("Enqueuing #{awaited_jobs.count} awaited jobs...", @job, @run)
|
54
52
|
# All jobs created in the block are pushed atomically at the end of the block.
|
55
53
|
AcidicJob::Run.transaction do
|
56
54
|
awaited_jobs.each do |awaited_job|
|
57
|
-
worker_class, args =
|
55
|
+
worker_class, args = job_and_args(awaited_job)
|
58
56
|
|
59
57
|
job = worker_class.new(*args)
|
60
58
|
|
@@ -67,10 +65,11 @@ module AcidicJob
|
|
67
65
|
def jobs_from(jobs_or_jobs_getter)
|
68
66
|
case jobs_or_jobs_getter
|
69
67
|
when Array
|
70
|
-
jobs_or_jobs_getter
|
68
|
+
jobs_or_jobs_getter.compact
|
71
69
|
when Symbol, String
|
72
70
|
if @job.respond_to?(jobs_or_jobs_getter, _include_private = true)
|
73
|
-
@job.method(jobs_or_jobs_getter).call
|
71
|
+
jobs = @job.method(jobs_or_jobs_getter).call
|
72
|
+
Array(jobs).compact
|
74
73
|
else
|
75
74
|
raise UnknownAwaitedJob,
|
76
75
|
"Invalid `awaits`; unknown method `#{jobs_or_jobs_getter}` for this job"
|
@@ -81,7 +80,7 @@ module AcidicJob
|
|
81
80
|
end
|
82
81
|
end
|
83
82
|
|
84
|
-
def
|
83
|
+
def job_and_args(job)
|
85
84
|
case job
|
86
85
|
when Class
|
87
86
|
[job, []]
|
data/lib/acidic_job/run.rb
CHANGED
@@ -130,7 +130,7 @@ module AcidicJob
|
|
130
130
|
# encode the identifier for this record in the job ID
|
131
131
|
global_id = to_global_id.to_s.remove("gid://")
|
132
132
|
# base64 encoding for minimal security
|
133
|
-
encoded_global_id = Base64.
|
133
|
+
encoded_global_id = Base64.urlsafe_encode64(global_id, padding: false)
|
134
134
|
|
135
135
|
[
|
136
136
|
STAGED_JOB_ID_PREFIX,
|
@@ -173,6 +173,10 @@ module AcidicJob
|
|
173
173
|
current_step_hash.fetch("then")
|
174
174
|
end
|
175
175
|
|
176
|
+
def current_step_awaits
|
177
|
+
current_step_hash["awaits"]
|
178
|
+
end
|
179
|
+
|
176
180
|
def next_step_finishes?
|
177
181
|
next_step_name.to_s == FINISHED_RECOVERY_POINT
|
178
182
|
end
|
data/lib/acidic_job/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acidic_job
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.beta.
|
4
|
+
version: 1.0.0.beta.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- fractaledmind
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-08-
|
11
|
+
date: 2022-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activejob
|
@@ -227,6 +227,7 @@ executables: []
|
|
227
227
|
extensions: []
|
228
228
|
extra_rdoc_files: []
|
229
229
|
files:
|
230
|
+
- ".github/FUNDING.yml"
|
230
231
|
- ".github/workflows/main.yml"
|
231
232
|
- ".gitignore"
|
232
233
|
- ".rubocop.yml"
|
@@ -271,6 +272,7 @@ files:
|
|
271
272
|
- lib/acidic_job/serializers/range_serializer.rb
|
272
273
|
- lib/acidic_job/serializers/recovery_point_serializer.rb
|
273
274
|
- lib/acidic_job/serializers/worker_serializer.rb
|
275
|
+
- lib/acidic_job/test_case.rb
|
274
276
|
- lib/acidic_job/testing.rb
|
275
277
|
- lib/acidic_job/version.rb
|
276
278
|
- lib/acidic_job/workflow.rb
|