acidic_job 1.0.0.pre5 → 1.0.0.pre6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -1
- data/UPGRADE_GUIDE.md +14 -14
- data/lib/acidic_job/run.rb +13 -0
- data/lib/acidic_job/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9247c761078c570dfbacac2542bc8b7417c816bb9928f975bf7b92722a29f6a4
|
4
|
+
data.tar.gz: 8d36bb7517db0493d37eaf44aee901339a5d8d77411cad0e55fefe2d940137c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47697f8b833d7061bacb2b6eaf1e6c15a9d6fec700db0891f881b8f945cf271e1c37adba9cde4572aed5d0e272767a690c172ece0937dbc212a90bc0dd02e8e5
|
7
|
+
data.tar.gz: cda551ac7a76a63199f03b19e7787ba0bfae414253b1e71b098b8304705458d0c8f21b1755f9f10c15b651d55b849469284754d6e585d13159ee4c28a17ed723
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
acidic_job (1.0.0.
|
4
|
+
acidic_job (1.0.0.pre6)
|
5
5
|
activerecord (>= 6.1.0)
|
6
6
|
activesupport
|
7
7
|
|
@@ -122,6 +122,8 @@ GEM
|
|
122
122
|
nokogiri (1.12.3)
|
123
123
|
mini_portile2 (~> 2.6.1)
|
124
124
|
racc (~> 1.4)
|
125
|
+
nokogiri (1.12.3-x86_64-darwin)
|
126
|
+
racc (~> 1.4)
|
125
127
|
noticed (1.5.7)
|
126
128
|
http (>= 4.0.0)
|
127
129
|
rails (>= 5.2.0)
|
data/UPGRADE_GUIDE.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# AcidicJob Upgrade Guide
|
2
2
|
|
3
|
-
1. Update version requirements in `Gemfile`
|
3
|
+
## 1. Update version requirements in `Gemfile`
|
4
4
|
|
5
|
-
```
|
6
|
-
-gem "acidic_job"
|
7
|
-
+gem "acidic_job", "~> 1.0.0.pre1"
|
5
|
+
```diff
|
6
|
+
- gem "acidic_job"
|
7
|
+
+ gem "acidic_job", "~> 1.0.0.pre1"
|
8
8
|
```
|
9
9
|
|
10
10
|
result:
|
@@ -13,7 +13,7 @@ Installing acidic_job 1.0.0.pre4 (was 0.7.7)
|
|
13
13
|
Bundle updated!
|
14
14
|
```
|
15
15
|
|
16
|
-
2. Generate migration for new `AcidicJob::Run` model
|
16
|
+
## 2. Generate migration for new `AcidicJob::Run` model
|
17
17
|
|
18
18
|
```bash
|
19
19
|
rails generate acidic_job
|
@@ -24,7 +24,7 @@ result:
|
|
24
24
|
create db/migrate/#{yyyymmddhhmmss}_create_acidic_job_runs.rb
|
25
25
|
```
|
26
26
|
|
27
|
-
3. Delete any unneeded `AcidicJob::Key` records
|
27
|
+
## 3. Delete any unneeded `AcidicJob::Key` records
|
28
28
|
|
29
29
|
Typically, records that are already finished do not need to be retained. Sometimes, however, applications key finished records around for some amount of time for debugging or metrics aggregation. Whatever your application's logic is for whether or not an `AcidicJob::Key` record is still needed, for all unneeded records, delete them.
|
30
30
|
|
@@ -34,7 +34,7 @@ For example, this would delete all finished `Key` records over 1 month old:
|
|
34
34
|
AcidicJob::Key.where(recovery_point: AcidicJob::Key::RECOVERY_POINT_FINISHED, last_run_at: ..1.month.ago).delete_all
|
35
35
|
```
|
36
36
|
|
37
|
-
4. Migrate `AcidicJob::Key` to `AcidicJob::Run`
|
37
|
+
## 4. Migrate `AcidicJob::Key` to `AcidicJob::Run`
|
38
38
|
|
39
39
|
`AcidicJob` ships with an upgrade module that provides a script to migrate older `Key` records to the new `Run` model.
|
40
40
|
|
@@ -47,21 +47,21 @@ This script will prepare an `insert_all` command for `Run` records by mapping th
|
|
47
47
|
result:
|
48
48
|
```
|
49
49
|
{
|
50
|
-
|
51
|
-
|
52
|
-
|
50
|
+
run_records: <Integer>,
|
51
|
+
key_records: <Integer>,
|
52
|
+
errored_keys: <Array>
|
53
53
|
}
|
54
54
|
```
|
55
55
|
|
56
|
-
5. Triage remaining `AcidicJob::Key` records
|
56
|
+
## 5. Triage remaining `AcidicJob::Key` records
|
57
57
|
|
58
58
|
If there were any `AcidicJob::Key` records that failed to be mapped to the new `Run` model, you will need to manually triage whatever the exception was. In all likelihood, the exception would be relating to the translation of the `Key#job_args` field to the `Run#serialized_job` field, as all other fields have a fairly straight-forward mapping. If you can't resolve the issue, please open an Issue in GitHub.
|
59
59
|
|
60
|
-
6. Ensure all `AcidicJob::Staged` records are processed
|
60
|
+
## 6. Ensure all `AcidicJob::Staged` records are processed
|
61
61
|
|
62
62
|
`AcidicJob` still ships with an upgrade module that provides the older `Key` and `Staged` records, so this functionality will still be present to handle any existing records in your database when you deploy the updated version.
|
63
63
|
|
64
|
-
7. Remove the old tables
|
64
|
+
## 7. Remove the old tables
|
65
65
|
|
66
66
|
Once you have successfully migrated everything over and the new system has been running smoothly for some time, you should drop the old `acidic_job_keys` and `staged_acidic_jobs` tables. We provide a migration generator just for this purpose:
|
67
67
|
|
@@ -78,4 +78,4 @@ You can then run the migration to have those tables removed:
|
|
78
78
|
|
79
79
|
```bash
|
80
80
|
rails db:migrate
|
81
|
-
```
|
81
|
+
```
|
data/lib/acidic_job/run.rb
CHANGED
@@ -35,6 +35,19 @@ module AcidicJob
|
|
35
35
|
validates :workflow, presence: true
|
36
36
|
end
|
37
37
|
|
38
|
+
def self.purge
|
39
|
+
successfully_completed = where(
|
40
|
+
recovery_point: FINISHED_RECOVERY_POINT,
|
41
|
+
error_object: nil
|
42
|
+
)
|
43
|
+
count = successfully_completed.count
|
44
|
+
|
45
|
+
return 0 if count.zero?
|
46
|
+
|
47
|
+
Rails.logger.info("Deleting #{count} successfully completed AcidicJob runs")
|
48
|
+
successfully_completed.delete_all
|
49
|
+
end
|
50
|
+
|
38
51
|
def finished?
|
39
52
|
recovery_point == FINISHED_RECOVERY_POINT
|
40
53
|
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.
|
4
|
+
version: 1.0.0.pre6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- fractaledmind
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|