simplekiq 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +29 -39
- data/CHANGELOG.md +21 -3
- data/CONTRIBUTING.md +12 -13
- data/CONTRIBUTORS.md +12 -5
- data/Gemfile +6 -0
- data/Gemfile.lock +33 -29
- data/README.md +27 -13
- data/lib/simplekiq/batch_tracker_job.rb +22 -0
- data/lib/simplekiq/batching_job.rb +2 -7
- data/lib/simplekiq/orchestration.rb +0 -4
- data/lib/simplekiq/orchestration_executor.rb +33 -28
- data/lib/simplekiq/orchestration_job.rb +18 -1
- data/lib/simplekiq/version.rb +1 -1
- data/lib/simplekiq.rb +16 -3
- data/simplekiq.gemspec +2 -6
- metadata +19 -32
- data/vendor/cache/ast-2.4.2.gem +0 -0
- data/vendor/cache/coderay-1.1.3.gem +0 -0
- data/vendor/cache/connection_pool-2.2.5.gem +0 -0
- data/vendor/cache/diff-lcs-1.5.0.gem +0 -0
- data/vendor/cache/method_source-1.0.0.gem +0 -0
- data/vendor/cache/parallel-1.22.1.gem +0 -0
- data/vendor/cache/parser-3.1.1.0.gem +0 -0
- data/vendor/cache/pry-0.13.1.gem +0 -0
- data/vendor/cache/rack-2.2.3.gem +0 -0
- data/vendor/cache/rack-protection-2.2.0.gem +0 -0
- data/vendor/cache/rainbow-3.1.1.gem +0 -0
- data/vendor/cache/rake-12.3.3.gem +0 -0
- data/vendor/cache/redis-4.5.1.gem +0 -0
- data/vendor/cache/regexp_parser-2.2.1.gem +0 -0
- data/vendor/cache/rexml-3.2.5.gem +0 -0
- data/vendor/cache/rspec-3.10.0.gem +0 -0
- data/vendor/cache/rspec-core-3.10.1.gem +0 -0
- data/vendor/cache/rspec-expectations-3.10.1.gem +0 -0
- data/vendor/cache/rspec-mocks-3.10.2.gem +0 -0
- data/vendor/cache/rspec-support-3.10.3.gem +0 -0
- data/vendor/cache/rspec_junit_formatter-0.5.1.gem +0 -0
- data/vendor/cache/rubocop-1.26.1.gem +0 -0
- data/vendor/cache/rubocop-ast-1.16.0.gem +0 -0
- data/vendor/cache/rubocop-performance-1.13.3.gem +0 -0
- data/vendor/cache/ruby-progressbar-1.11.0.gem +0 -0
- data/vendor/cache/sidekiq-5.2.10.gem +0 -0
- data/vendor/cache/standard-1.9.1.gem +0 -0
- data/vendor/cache/unicode-display_width-2.1.0.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20c1cf9ee3200ead5a9c6c0bba128b1688c1a7c7ecab72caaf024341c2d8ba35
|
4
|
+
data.tar.gz: 1b749cdbdead50f3458912b641b20cdf186a2e53a4581d8bd15a91df7e2bfa4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b77d61ceca98ea9d78e491b527e0a181b3e51803581083b39b0fece0303c9d0736e5b66eb3e68fed45222da5f66e6cb75ba82ecaa8034f0b8dd52bf252958bf
|
7
|
+
data.tar.gz: 91afa04b5e0879132c777dc816887f81ed4de6cdf04c916066fc1d634202eca0a8dbef32173c1a8329ffd0902135669be57ed6e33e1d44d228e5352193a89fcf
|
data/.circleci/config.yml
CHANGED
@@ -4,20 +4,28 @@ orbs:
|
|
4
4
|
gem: doximity/gem-publisher@0
|
5
5
|
|
6
6
|
executors:
|
7
|
-
ruby
|
7
|
+
ruby:
|
8
8
|
resource_class: small
|
9
9
|
docker:
|
10
10
|
- image: cimg/ruby:2.6
|
11
11
|
environment:
|
12
|
-
BUNDLE_VERSION: "~> 1.
|
12
|
+
BUNDLE_VERSION: "~> 2.1.4"
|
13
|
+
ruby-with-redis:
|
14
|
+
resource_class: small
|
15
|
+
docker:
|
16
|
+
- image: cimg/ruby:2.6
|
17
|
+
environment:
|
18
|
+
BUNDLE_VERSION: "~> 2.1.4"
|
19
|
+
- image: redis:4-alpine
|
20
|
+
command: redis-server
|
13
21
|
|
14
22
|
# yaml anchor filters
|
15
|
-
|
23
|
+
always_run: &always_run
|
16
24
|
filters:
|
17
25
|
branches:
|
18
|
-
only:
|
26
|
+
only: /.*/
|
19
27
|
tags:
|
20
|
-
|
28
|
+
only: /^v.*/
|
21
29
|
pr_only: &pr_only
|
22
30
|
filters:
|
23
31
|
branches:
|
@@ -33,7 +41,7 @@ version_tags_only: &version_tags_only
|
|
33
41
|
|
34
42
|
jobs:
|
35
43
|
build:
|
36
|
-
executor: ruby-
|
44
|
+
executor: ruby-with-redis
|
37
45
|
steps:
|
38
46
|
- checkout
|
39
47
|
- run:
|
@@ -42,15 +50,14 @@ jobs:
|
|
42
50
|
gem install bundler --version "${BUNDLE_VERSION}" --force
|
43
51
|
- restore_cache:
|
44
52
|
keys:
|
45
|
-
-
|
53
|
+
- v4-bundle-{{ checksum "Gemfile.lock" }}-
|
46
54
|
- run:
|
47
55
|
name: Install Ruby Dependencies
|
48
56
|
command: |
|
49
57
|
bundle config set --local path 'vendor/bundle'
|
50
|
-
bundle
|
51
|
-
bundle install --local --jobs=4 --retry=3
|
58
|
+
bundle install --jobs=4 --retry=3
|
52
59
|
- save_cache:
|
53
|
-
key:
|
60
|
+
key: v4-bundle-{{ checksum "Gemfile.lock" }}-
|
54
61
|
paths:
|
55
62
|
- vendor/bundle
|
56
63
|
- run:
|
@@ -68,27 +75,19 @@ jobs:
|
|
68
75
|
- vendor/bundle
|
69
76
|
|
70
77
|
workflows:
|
71
|
-
version: 2
|
72
|
-
|
73
|
-
trunk:
|
74
|
-
jobs:
|
75
|
-
- build:
|
76
|
-
<<: *master_only
|
77
|
-
- gem/build:
|
78
|
-
<<: *master_only
|
79
|
-
executor: ruby-2-6
|
80
|
-
name: gem-build
|
81
|
-
requires:
|
82
|
-
- build
|
83
78
|
|
84
|
-
|
79
|
+
main:
|
85
80
|
jobs:
|
86
81
|
- build:
|
87
|
-
<<: *
|
82
|
+
<<: *always_run
|
83
|
+
context: sidekiq-enterprise
|
88
84
|
- gem/build:
|
89
|
-
<<: *
|
90
|
-
|
85
|
+
<<: *always_run
|
86
|
+
context: sidekiq-enterprise
|
87
|
+
executor: ruby
|
91
88
|
name: gem-build
|
89
|
+
vendor-cache: false
|
90
|
+
cache-salt: simplekiq-v2
|
92
91
|
requires:
|
93
92
|
- build
|
94
93
|
- pre-release-approval:
|
@@ -98,26 +97,17 @@ workflows:
|
|
98
97
|
- gem-build
|
99
98
|
- gem/publish:
|
100
99
|
<<: *pr_only
|
101
|
-
|
100
|
+
executor: ruby
|
101
|
+
name: gem-publish-pre
|
102
102
|
to_rubygems: true
|
103
103
|
pre_release: true
|
104
104
|
requires:
|
105
105
|
- pre-release-approval
|
106
106
|
context: artifact_publishing
|
107
|
-
|
108
|
-
final-release:
|
109
|
-
jobs:
|
110
|
-
- build:
|
111
|
-
<<: *version_tags_only
|
112
|
-
- gem/build:
|
113
|
-
<<: *version_tags_only
|
114
|
-
executor: ruby-2-6
|
115
|
-
name: gem-build
|
116
|
-
requires:
|
117
|
-
- build
|
118
107
|
- gem/publish:
|
119
108
|
<<: *version_tags_only
|
120
|
-
name: gem-publish
|
109
|
+
name: gem-publish-final
|
110
|
+
executor: ruby
|
121
111
|
to_rubygems: true
|
122
112
|
pre_release: false
|
123
113
|
requires:
|
data/CHANGELOG.md
CHANGED
@@ -4,11 +4,29 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## [0.1.0] (pre-release for 1.0)
|
8
|
+
* Fix typo in CONTRIBUTORS
|
9
|
+
[#5](https://github.com/doximity/simplekiq/pull/5)
|
10
|
+
* Fix incorrectly named spec file
|
11
|
+
[#9](https://github.com/doximity/simplekiq/pull/9)
|
12
|
+
* README fix
|
13
|
+
[#10](https://github.com/doximity/simplekiq/pull/10)
|
14
|
+
* Updating CONTRIBUTING license
|
15
|
+
[#16](https://github.com/doximity/simplekiq/pull/16)
|
16
|
+
* Fix CHANGELOG typo
|
17
|
+
[#18](https://github.com/doximity/simplekiq/pull/18)
|
18
|
+
* Add sidekiq-pro as an explicit dependency and loosen sidekiq requirements
|
19
|
+
[#19](https://github.com/doximity/simplekiq/pull/19)
|
20
|
+
* Add new toplevel batch to encapsulate all batches within an orchestration
|
21
|
+
[#21](https://github.com/doximity/simplekiq/pull/21)
|
22
|
+
* Fix bug with toplevel batch and include batch descriptions
|
23
|
+
[#23](https://github.com/doximity/simplekiq/pull/23)
|
24
|
+
|
7
25
|
## [0.0.3]
|
8
|
-
* Misc minimal fixes to get the gem building and releasable
|
9
|
-
[#
|
26
|
+
* Misc minimal fixes to get the gem building and releasable according to our open source standards
|
27
|
+
[#3](https://github.com/doximity/simplekiq/pull/3)
|
10
28
|
* Copy over library code from prior sources with maintained history
|
11
|
-
[#
|
29
|
+
[#2](https://github.com/doximity/simplekiq/pull/2)
|
12
30
|
|
13
31
|
## [0.0.2]
|
14
32
|
* Scrubbed version from rubygems, do not use
|
data/CONTRIBUTING.md
CHANGED
@@ -1,31 +1,30 @@
|
|
1
|
-
# Contributing
|
1
|
+
# Contributing to Doximity
|
2
2
|
|
3
3
|
We welcome contributions to this repository. Feel free to submit issues for bugs you encounter and pull requests for code and documentation contributions.
|
4
|
+
In order to prevent licensing issues, Doximity Inc. (“Doximity”, “we”, “us”) requires all contributors to agree to an Individual Contributor License Agreement (“CLA”), which is reproduced below. By submitting your contributions to us, you agree that you have read and are bound by the CLA. If you do not agree with the CLA, you may not submit contributions.
|
4
5
|
|
5
|
-
|
6
|
+
## Doximity Individual Contributor License Agreement
|
6
7
|
|
7
|
-
|
8
|
+
This license is for your protection as a Contributor as well as the protection of Doximity; it does not change your rights to use your own Contributions for any other purpose.
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
You accept and agree to the following terms and conditions for Your present and future Contributions submitted to Doximity. Except for the license granted herein to Doximity and recipients of software distributed by Doximity, You reserve all right, title, and interest in and to Your Contributions.
|
10
|
+
You accept and agree to the following terms and conditions for Your present and future Contributions submitted to Doximity. Except for the license granted herein to Doximity and recipients of software distributed by Doximity, You reserve all right, titles, and interests in and to Your Contributions.
|
12
11
|
|
13
12
|
### Definitions
|
14
13
|
|
15
|
-
"You" (or "Your") shall mean the copyright owner or legal entity authorized by the copyright owner that is making this Agreement with Doximity. For legal entities, the entity making a Contribution and all other entities that control, are controlled by, or are under common control with that entity are considered to be a single Contributor. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
14
|
+
"You" (or "Your" or the “Contributor”) shall mean the copyright owner or legal entity authorized by the copyright owner that is making this Agreement with Doximity. For legal entities, the entity making a Contribution and all other entities that control, are controlled by, or are under common control with that entity are considered to be a single Contributor. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
16
15
|
|
17
|
-
1. "Contribution" shall mean any original work of authorship, including any modifications or additions to an existing work, that is intentionally submitted by You to Doximity for inclusion in, or documentation of, any of the products owned or managed by Doximity (the "Work"). For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to Doximity or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, Doximity for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by You as "Not a Contribution."
|
16
|
+
1. "Contribution" shall mean the code, documentation, or any original work of authorship, including any modifications or additions to an existing work, that is intentionally submitted by You to Doximity for inclusion in, or documentation of, any of the products owned or managed by Doximity (the "Work"). For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to Doximity or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, Doximity for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by You as "Not a Contribution."
|
18
17
|
|
19
18
|
2. Grant of Copyright License. Subject to the terms and conditions of this Agreement, You hereby grant to Doximity and to recipients of software distributed by Doximity a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute Your Contributions and such derivative works.
|
20
19
|
|
21
|
-
3. Grant of Patent License. Subject to the terms and conditions of this Agreement, You hereby grant to Doximity and to recipients of software distributed by Doximity a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by You that are necessarily infringed by Your Contribution(s) alone or by combination of Your Contribution(s) with the Work to which such Contribution(s) was submitted. If any entity institutes patent litigation against You or any other entity (including a cross-claim or counterclaim in a lawsuit) alleging that your Contribution, or the Work to which you have contributed, constitutes direct or contributory patent infringement, then any patent licenses granted to that entity under this Agreement for that Contribution or Work shall terminate as of the date such litigation is filed.
|
20
|
+
3. Grant of Patent License. Subject to the terms and conditions of this Agreement, You hereby grant to Doximity and to recipients of software distributed by Doximity a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by You that are necessarily infringed by Your Contribution(s) alone or by a combination of Your Contribution(s) with the Work to which such Contribution(s) was submitted. If any entity institutes patent litigation against You or any other entity (including a cross-claim or counterclaim in a lawsuit) alleging that your Contribution, or the Work to which you have contributed, constitutes a direct or contributory patent infringement, then any patent licenses granted to that entity under this Agreement for that Contribution or Work shall terminate as of the date such litigation is filed.
|
22
21
|
|
23
|
-
4. You represent that
|
22
|
+
4. You represent that You are legally entitled to grant the above license. If your employer(s) has rights to intellectual property that you create that includes your Contributions, you represent that you have received permission to make Contributions on behalf of that employer, that your employer has waived such rights for your Contributions to Doximity, or that your employer has executed a separate Corporate CLA with Doximity.
|
24
23
|
|
25
24
|
5. You represent that each of Your Contributions is Your original creation (see section 7 for submissions on behalf of others). You represent that Your Contribution submissions include complete details of any third-party license or other restriction (including, but not limited to, related patents and trademarks) of which you are personally aware and which are associated with any part of Your Contributions.
|
26
25
|
|
27
|
-
6. You are not expected to provide support for Your Contributions, except to the extent You desire to provide support. You may provide support for free, for a fee, or not at all. Unless required by applicable law or agreed to in writing, You provide Your Contributions on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-
|
26
|
+
6. You are not expected to provide support for Your Contributions, except to the extent You desire to provide support. You may provide support for free, for a fee, or not at all. Unless required by applicable law or agreed to in writing, You provide Your Contributions on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.
|
28
27
|
|
29
|
-
7. Should You wish to submit work that is not Your original creation, You may submit it to Doximity separately from any Contribution, identifying the complete details of its source and of any license or other restriction (including, but not limited to, related patents, trademarks, and license agreements) of which you are personally aware, and conspicuously marking the work as "Submitted on behalf of a third-party: [
|
28
|
+
7. Should You wish to submit work that is not Your original creation, You may submit it to Doximity separately from any Contribution, identifying the complete details of its source and of any license or other restriction (including, but not limited to, related patents, trademarks, and license agreements) of which you are personally aware, and conspicuously marking the work as "Submitted on behalf of a third-party: [named here]".
|
30
29
|
|
31
|
-
8. You agree to notify Doximity of any facts or circumstances of which you become aware that would make these representations inaccurate in any respect.
|
30
|
+
8. You agree to notify Doximity of any facts or circumstances of which you become aware that would make these representations inaccurate in any respect.
|
data/CONTRIBUTORS.md
CHANGED
@@ -1,22 +1,29 @@
|
|
1
1
|
## List of All Known Code Contributors to Simplekiq
|
2
2
|
|
3
|
-
### Jack Noble
|
3
|
+
### Jack Noble (Doximity)
|
4
4
|
* Collaborated on initial concept
|
5
5
|
* Wrote the majority of the code as of initial release
|
6
|
+
* Helpful contributions to maintenance of specs, README, etc
|
6
7
|
|
7
|
-
### John Wilkinson
|
8
|
+
### John Wilkinson (Doximity)
|
8
9
|
* Collaborated on initial concept
|
9
10
|
* Conducted the gem extraction and release
|
10
11
|
|
11
|
-
###
|
12
|
+
### Jason Hagglund (Doximity)
|
13
|
+
* Finagled a way into getting us the ability to specify `sidekiq-pro` as an explicit dependency despite it not being publicly available and without exposing it to the public in the process.
|
14
|
+
|
15
|
+
### Brian Dillard (Doximity)
|
12
16
|
* Added additional comment documentation
|
13
17
|
* Added support for `on_complete` batch callback support in `Simplekiq::BatchingJob`
|
14
18
|
|
15
|
-
###
|
19
|
+
### Austen Madden (Doximity)
|
16
20
|
* Fixed bug with batch statuses in callbacks for empty batches
|
17
21
|
|
18
|
-
### Tiffany Troha
|
22
|
+
### Tiffany Troha (Doximity)
|
19
23
|
* Added support for specifying `sidekiq_options` for the child job in `Simplekiq::BatchingJob`
|
20
24
|
|
21
25
|
### [Daniel Pepper](https://github.com/dpep)
|
22
26
|
* On request, graciously took down his unused `simplekiq` placeholder from rubygems so we could continue using the name :raised_hands:
|
27
|
+
|
28
|
+
### [Jeremy Smith](https://github.com/jeremysmithco)
|
29
|
+
* Helpfully and respectfully nudged us towards loosening our sidekiq version requirement
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
simplekiq (0.0
|
5
|
-
sidekiq (
|
4
|
+
simplekiq (0.1.0)
|
5
|
+
sidekiq (>= 5.2.9)
|
6
|
+
sidekiq-pro (~> 5.0)
|
6
7
|
|
7
8
|
GEM
|
8
9
|
remote: https://rubygems.org/
|
10
|
+
remote: https://enterprise.contribsys.com/
|
9
11
|
specs:
|
10
12
|
ast (2.4.2)
|
11
13
|
coderay (1.1.3)
|
@@ -13,56 +15,56 @@ GEM
|
|
13
15
|
diff-lcs (1.5.0)
|
14
16
|
method_source (1.0.0)
|
15
17
|
parallel (1.22.1)
|
16
|
-
parser (3.1.
|
18
|
+
parser (3.1.2.0)
|
17
19
|
ast (~> 2.4.1)
|
18
|
-
pry (0.
|
20
|
+
pry (0.14.1)
|
19
21
|
coderay (~> 1.1)
|
20
22
|
method_source (~> 1.0)
|
21
|
-
rack (2.2.
|
22
|
-
rack-protection (2.2.0)
|
23
|
-
rack
|
23
|
+
rack (2.2.4)
|
24
24
|
rainbow (3.1.1)
|
25
25
|
rake (12.3.3)
|
26
|
-
redis (4.
|
27
|
-
regexp_parser (2.
|
26
|
+
redis (4.7.1)
|
27
|
+
regexp_parser (2.3.1)
|
28
28
|
rexml (3.2.5)
|
29
|
-
rspec (3.
|
30
|
-
rspec-core (~> 3.
|
31
|
-
rspec-expectations (~> 3.
|
32
|
-
rspec-mocks (~> 3.
|
33
|
-
rspec-core (3.
|
34
|
-
rspec-support (~> 3.
|
35
|
-
rspec-expectations (3.
|
29
|
+
rspec (3.11.0)
|
30
|
+
rspec-core (~> 3.11.0)
|
31
|
+
rspec-expectations (~> 3.11.0)
|
32
|
+
rspec-mocks (~> 3.11.0)
|
33
|
+
rspec-core (3.11.0)
|
34
|
+
rspec-support (~> 3.11.0)
|
35
|
+
rspec-expectations (3.11.0)
|
36
36
|
diff-lcs (>= 1.2.0, < 2.0)
|
37
|
-
rspec-support (~> 3.
|
38
|
-
rspec-mocks (3.
|
37
|
+
rspec-support (~> 3.11.0)
|
38
|
+
rspec-mocks (3.11.1)
|
39
39
|
diff-lcs (>= 1.2.0, < 2.0)
|
40
|
-
rspec-support (~> 3.
|
41
|
-
rspec-support (3.
|
40
|
+
rspec-support (~> 3.11.0)
|
41
|
+
rspec-support (3.11.0)
|
42
42
|
rspec_junit_formatter (0.5.1)
|
43
43
|
rspec-core (>= 2, < 4, != 2.12.0)
|
44
|
-
rubocop (1.
|
44
|
+
rubocop (1.28.2)
|
45
45
|
parallel (~> 1.10)
|
46
46
|
parser (>= 3.1.0.0)
|
47
47
|
rainbow (>= 2.2.2, < 4.0)
|
48
48
|
regexp_parser (>= 1.8, < 3.0)
|
49
49
|
rexml
|
50
|
-
rubocop-ast (>= 1.
|
50
|
+
rubocop-ast (>= 1.17.0, < 2.0)
|
51
51
|
ruby-progressbar (~> 1.7)
|
52
52
|
unicode-display_width (>= 1.4.0, < 3.0)
|
53
|
-
rubocop-ast (1.
|
53
|
+
rubocop-ast (1.17.0)
|
54
54
|
parser (>= 3.1.1.0)
|
55
55
|
rubocop-performance (1.13.3)
|
56
56
|
rubocop (>= 1.7.0, < 2.0)
|
57
57
|
rubocop-ast (>= 0.4.0)
|
58
58
|
ruby-progressbar (1.11.0)
|
59
|
-
sidekiq (
|
60
|
-
connection_pool (
|
59
|
+
sidekiq (6.1.0)
|
60
|
+
connection_pool (>= 2.2.2)
|
61
61
|
rack (~> 2.0)
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
62
|
+
redis (>= 4.2.0)
|
63
|
+
sidekiq-pro (5.2.1)
|
64
|
+
connection_pool (>= 2.2.3)
|
65
|
+
sidekiq (>= 6.1.0)
|
66
|
+
standard (1.11.0)
|
67
|
+
rubocop (= 1.28.2)
|
66
68
|
rubocop-performance (= 1.13.3)
|
67
69
|
unicode-display_width (2.1.0)
|
68
70
|
|
@@ -74,6 +76,8 @@ DEPENDENCIES
|
|
74
76
|
rake (~> 12.0)
|
75
77
|
rspec (~> 3.2)
|
76
78
|
rspec_junit_formatter
|
79
|
+
sidekiq (= 6.1.0)
|
80
|
+
sidekiq-pro (= 5.2.1)!
|
77
81
|
simplekiq!
|
78
82
|
standard
|
79
83
|
|
data/README.md
CHANGED
@@ -10,7 +10,7 @@ Add this line to your application's Gemfile:
|
|
10
10
|
gem "simplekiq"
|
11
11
|
```
|
12
12
|
|
13
|
-
Note that this gem requires you be a Sidekiq Pro paid subscriber to be able to use it, so after following the installation docs for getting the private gem configured with your system, ensure you have `sidekiq-pro` at version `~> 5.0.0` or higher and that it's being required:
|
13
|
+
Note that this gem requires you be a Sidekiq Pro paid subscriber to be able to use it, so after following the installation docs for getting the private gem configured with your system, ensure you have `sidekiq-pro` at version `~> 5.0.0` or higher (need at least version `5.2.1` if you want to capture `on_death` callbacks [percolating up to parent batches](https://github.com/mperham/sidekiq/blob/main/Pro-Changes.md#521) - a supported feature which is not required for typical orchestration behavior) and that it's being required:
|
14
14
|
|
15
15
|
```ruby
|
16
16
|
gem "sidekiq-pro", "~> 5.0.0"
|
@@ -38,8 +38,7 @@ There are currently two primary components of the system which were designed to
|
|
38
38
|
Mixing in the [Simplekiq::Orchestration](./lib/simplekiq/orchestration_job.rb) module lets you define a human-readable workflow of jobs in a single file with almost* no special requirements or restrictions on how the child jobs are designed. In most cases, Sidekiq jobs not designed for use in orchestrations should be compatible for use in orchestrations. A job implementing `OrchestrationJob` might look like:
|
39
39
|
|
40
40
|
```ruby
|
41
|
-
class SomeOrchestrationJob
|
42
|
-
include Sidekiq::Worker
|
41
|
+
class SomeOrchestrationJob
|
43
42
|
include Simplekiq::OrchestrationJob
|
44
43
|
|
45
44
|
def perform_orchestration(some_id)
|
@@ -56,6 +55,17 @@ class SomeOrchestrationJob < BaseJob
|
|
56
55
|
run SomeFinalizationJob, some_model.id # 4.
|
57
56
|
end
|
58
57
|
|
58
|
+
def on_death(status, options) # 5.
|
59
|
+
SomeModel.find(options["args"].first).failure_happened!
|
60
|
+
end
|
61
|
+
|
62
|
+
def on_complete(status, options) # 6.
|
63
|
+
failures = Array(status&.failure_info) # sidekiq-pro batch status api
|
64
|
+
return if failures.empty?
|
65
|
+
|
66
|
+
SomeModel.find(options["args"].first).it_was_these_failures(failures)
|
67
|
+
end
|
68
|
+
|
59
69
|
private
|
60
70
|
|
61
71
|
attr_reader :some_model
|
@@ -72,6 +82,8 @@ Let's use the above example to describe some specifics of how the flow works.
|
|
72
82
|
2. It does some initial work in `SomeInitialSetupJob`, which blocks the rest of the workflow until it completes successfully.
|
73
83
|
3. Then it will run a `SomeParallelizableJob` for each of some number of associated models `some_related_models`. These jobs will all run parallel to each other independently.
|
74
84
|
4. Finally, after all of the parallel jobs from #3 complete successfully, `SomeFinalizationJob` will run and then after it finishes the orchestration will be complete.
|
85
|
+
5. If it ran into an error at some point, `on_death` will get fired with the first failure. (please use `sidekiq-pro` of at least `5.2.1` for this feature)
|
86
|
+
6. It will call `on_complete` at the end of the orchestration no matter what, this is the place to collect all the failures and persist them somewhere.
|
75
87
|
|
76
88
|
**Note** - it's fine to add utility methods and `attr_accessor`s to keep the code tidy and maintainable.
|
77
89
|
|
@@ -105,26 +117,28 @@ The crux of the problem was that each job was highly coupled to its position in
|
|
105
117
|
|
106
118
|
## Versioning
|
107
119
|
|
108
|
-
This project follows semantic versioning.
|
120
|
+
This project follows semantic versioning. See https://semver.org/ for details.
|
109
121
|
|
110
122
|
## Development
|
111
123
|
|
112
124
|
After checking out the repo, run `bin/setup` to install dependencies. Note that this depends on `sidekiq-pro` which requires a [commercial license](https://sidekiq.org/products/pro.html) to install and use.
|
113
125
|
|
114
|
-
Then, run `rake
|
126
|
+
Then, run `rake ci:specs` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
127
|
+
|
128
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
115
129
|
|
116
|
-
To
|
130
|
+
To get a new release cut, please either open a PR or an issue with your ask with as much context as possible and someone from Doximity will consider your request. If it makes sense for the direction of the project we'll get it done and inform you of when a release has been made available with the changes.
|
117
131
|
|
118
|
-
|
132
|
+
For internal employees: consult the company wiki on the current standard process for conducting releases for our public gems.
|
119
133
|
|
120
134
|
## Contributing
|
121
135
|
|
122
|
-
1.
|
123
|
-
2.
|
124
|
-
3.
|
125
|
-
4.
|
126
|
-
5.
|
127
|
-
6.
|
136
|
+
1. See [CONTRIBUTING.md](./CONTRIBUTING.md)
|
137
|
+
2. Fork it
|
138
|
+
3. Create your feature branch (`git checkout -b my-new-feature`)
|
139
|
+
4. Commit your changes (`git commit -am 'Add some feature'`)
|
140
|
+
5. Push to the branch (`git push origin my-new-feature`)
|
141
|
+
6. Create a new Pull Request
|
128
142
|
|
129
143
|
## License
|
130
144
|
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This job serves two purposes:
|
4
|
+
# * TODO: It provides a convenient way to track top-level orchestration batches
|
5
|
+
# * The top-level orchestration batch would otherwise be empty (aside from
|
6
|
+
# child-batches) and all sidekiq-pro batches must have at least 1 job
|
7
|
+
|
8
|
+
module Simplekiq
|
9
|
+
class BatchTrackerJob
|
10
|
+
include Sidekiq::Worker
|
11
|
+
|
12
|
+
def perform(klass_name, bid, args)
|
13
|
+
# In the future, this will likely surface the toplevel batch to a callback method on the
|
14
|
+
# orchestration job. We're holding off on this until we have time to design a comprehensive
|
15
|
+
# plan for providing simplekiq-wide instrumentation, ideally while being backwards compatible
|
16
|
+
# for in-flight orchestrations.
|
17
|
+
|
18
|
+
# For now, it's just satisfying the all-batches-must-have-jobs limitation in sidekiq-pro
|
19
|
+
# described at the head of the file.
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -108,10 +108,7 @@ module Simplekiq
|
|
108
108
|
if !batches.empty?
|
109
109
|
flush_batches(args)
|
110
110
|
else
|
111
|
-
|
112
|
-
# that case by immediately manually invoking :complete & :success.
|
113
|
-
on_complete(nil, {"args" => args}) if respond_to?(:on_complete)
|
114
|
-
on_success(nil, {"args" => args}) if respond_to?(:on_success)
|
111
|
+
Simplekiq.run_empty_callbacks(self, args: args)
|
115
112
|
end
|
116
113
|
end
|
117
114
|
|
@@ -119,9 +116,7 @@ module Simplekiq
|
|
119
116
|
batch_job_class = self.class.const_get(BATCH_CLASS_NAME)
|
120
117
|
sidekiq_batch.description ||= "Simplekiq Batch Jobs for #{self.class.name}, args: #{args}"
|
121
118
|
|
122
|
-
|
123
|
-
sidekiq_batch.on("complete", self.class, "args" => args) if respond_to?(:on_complete)
|
124
|
-
sidekiq_batch.on("success", self.class, "args" => args) if respond_to?(:on_success)
|
119
|
+
Simplekiq.auto_define_callbacks(sidekiq_batch, args: args, job: self)
|
125
120
|
|
126
121
|
sidekiq_batch.jobs do
|
127
122
|
batches.each do |job_args|
|
@@ -21,10 +21,6 @@ module Simplekiq
|
|
21
21
|
serial_workflow
|
22
22
|
end
|
23
23
|
|
24
|
-
def execute(parent_batch)
|
25
|
-
OrchestrationExecutor.execute(workflow: serialized_workflow, parent_batch: parent_batch)
|
26
|
-
end
|
27
|
-
|
28
24
|
def serialized_workflow
|
29
25
|
@serialized_workflow ||= serial_workflow.map do |step|
|
30
26
|
case step[0]
|
@@ -2,45 +2,50 @@
|
|
2
2
|
|
3
3
|
module Simplekiq
|
4
4
|
class OrchestrationExecutor
|
5
|
-
def self.execute(
|
6
|
-
|
7
|
-
|
5
|
+
def self.execute(args:, job:, workflow:)
|
6
|
+
if workflow.empty?
|
7
|
+
Simplekiq.run_empty_callbacks(job, args: args)
|
8
|
+
return
|
9
|
+
end
|
8
10
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
self.class,
|
18
|
-
"orchestration_workflow" => workflow, "step" => step + 1
|
19
|
-
)
|
20
|
-
|
21
|
-
sidekiq_batch.jobs do
|
22
|
-
jobs.each do |job|
|
23
|
-
Object.const_get(job["klass"]).perform_async(*job["args"])
|
24
|
-
end
|
25
|
-
end
|
11
|
+
orchestration_batch = Sidekiq::Batch.new
|
12
|
+
orchestration_batch.description = "#{job.class.name} Simplekiq orchestration"
|
13
|
+
Simplekiq.auto_define_callbacks(orchestration_batch, args: args, job: job)
|
14
|
+
|
15
|
+
orchestration_batch.jobs do
|
16
|
+
Simplekiq::BatchTrackerJob.perform_async(job.class.name, orchestration_batch.bid, args)
|
17
|
+
|
18
|
+
new.run_step(workflow, 0)
|
26
19
|
end
|
27
20
|
end
|
28
21
|
|
29
|
-
def
|
30
|
-
|
31
|
-
|
32
|
-
|
22
|
+
def run_step(workflow, step)
|
23
|
+
*jobs = workflow.at(step)
|
24
|
+
# This will never be empty because Orchestration#serialized_workflow skips inserting
|
25
|
+
# a new step for in_parallel if there were no inner jobs specified.
|
26
|
+
|
27
|
+
next_step = step + 1
|
28
|
+
step_batch = Sidekiq::Batch.new
|
29
|
+
step_batch.description = "Simplekiq orchestrated step #{next_step}"
|
30
|
+
step_batch.on(
|
31
|
+
"success",
|
32
|
+
self.class,
|
33
|
+
{"orchestration_workflow" => workflow, "step" => next_step}
|
34
|
+
)
|
35
|
+
|
36
|
+
step_batch.jobs do
|
37
|
+
jobs.each do |job|
|
38
|
+
Object.const_get(job["klass"]).perform_async(*job["args"])
|
33
39
|
end
|
34
|
-
else
|
35
|
-
yield
|
36
40
|
end
|
37
41
|
end
|
38
42
|
|
39
43
|
def on_success(status, options)
|
40
44
|
return if options["step"] == options["orchestration_workflow"].length
|
41
45
|
|
42
|
-
|
43
|
-
|
46
|
+
Sidekiq::Batch.new(status.parent_bid).jobs do
|
47
|
+
run_step(options["orchestration_workflow"], options["step"])
|
48
|
+
end
|
44
49
|
end
|
45
50
|
end
|
46
51
|
end
|
@@ -11,7 +11,14 @@ module Simplekiq
|
|
11
11
|
|
12
12
|
def perform(*args)
|
13
13
|
perform_orchestration(*args)
|
14
|
-
|
14
|
+
|
15
|
+
# This makes it so that if there is a parent batch which this orchestration is run under, then the layered batches will be:
|
16
|
+
# parent_batch( orchestration_batch( batch_of_first_step_of_the_orchestration ) )
|
17
|
+
# If there is no parent batch, then it will simply be:
|
18
|
+
# orchestration_batch( batch_of_first_step_of_the_orchestration )
|
19
|
+
conditionally_within_parent_batch do
|
20
|
+
OrchestrationExecutor.execute(args: args, job: self, workflow: orchestration.serialized_workflow)
|
21
|
+
end
|
15
22
|
end
|
16
23
|
|
17
24
|
def workflow_plan(*args)
|
@@ -21,6 +28,16 @@ module Simplekiq
|
|
21
28
|
|
22
29
|
private
|
23
30
|
|
31
|
+
def conditionally_within_parent_batch
|
32
|
+
if batch
|
33
|
+
batch.jobs do
|
34
|
+
yield
|
35
|
+
end
|
36
|
+
else
|
37
|
+
yield
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
24
41
|
def orchestration
|
25
42
|
@orchestration ||= Orchestration.new
|
26
43
|
end
|
data/lib/simplekiq/version.rb
CHANGED
data/lib/simplekiq.rb
CHANGED
@@ -1,14 +1,27 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "sidekiq"
|
4
|
-
|
5
|
-
# NB: You must explicitly require sidekiq-ent in your app!
|
6
|
-
# require "sidekiq-ent"
|
4
|
+
require "sidekiq-pro"
|
7
5
|
|
8
6
|
require "simplekiq/orchestration_executor"
|
9
7
|
require "simplekiq/orchestration"
|
10
8
|
require "simplekiq/orchestration_job"
|
11
9
|
require "simplekiq/batching_job"
|
10
|
+
require "simplekiq/batch_tracker_job"
|
12
11
|
|
13
12
|
module Simplekiq
|
13
|
+
class << self
|
14
|
+
# Empty batches with no jobs will never invoke callbacks, so handle
|
15
|
+
# that case by immediately manually invoking :complete & :success.
|
16
|
+
def run_empty_callbacks(job, args:)
|
17
|
+
job.on_complete(nil, {"args" => args}) if job.respond_to?(:on_complete)
|
18
|
+
job.on_success(nil, {"args" => args}) if job.respond_to?(:on_success)
|
19
|
+
end
|
20
|
+
|
21
|
+
def auto_define_callbacks(batch, args:, job:)
|
22
|
+
batch.on("death", job.class, "args" => args) if job.respond_to?(:on_death)
|
23
|
+
batch.on("complete", job.class, "args" => args) if job.respond_to?(:on_complete)
|
24
|
+
batch.on("success", job.class, "args" => args) if job.respond_to?(:on_success)
|
25
|
+
end
|
26
|
+
end
|
14
27
|
end
|
data/simplekiq.gemspec
CHANGED
@@ -29,10 +29,6 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_development_dependency "pry"
|
30
30
|
spec.add_development_dependency "standard"
|
31
31
|
|
32
|
-
spec.add_dependency "sidekiq", "
|
33
|
-
|
34
|
-
# Can't define this explicitly because it would be inappropriate to vendor this
|
35
|
-
# pay-to-use library into the gem and it is not available on rubygems and
|
36
|
-
# this otherwise interferes with our publishing process.
|
37
|
-
# spec.add_dependency "sidekiq-pro", "~> 5.0.0"
|
32
|
+
spec.add_dependency "sidekiq", ">= 5.2.9"
|
33
|
+
spec.add_dependency "sidekiq-pro", "~> 5.0"
|
38
34
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simplekiq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jack Noble
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-
|
12
|
+
date: 2022-08-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -85,16 +85,30 @@ dependencies:
|
|
85
85
|
name: sidekiq
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- - "
|
88
|
+
- - ">="
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: 5.2.9
|
91
91
|
type: :runtime
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
|
-
- - "
|
95
|
+
- - ">="
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: 5.2.9
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: sidekiq-pro
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - "~>"
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '5.0'
|
105
|
+
type: :runtime
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - "~>"
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '5.0'
|
98
112
|
description: Provides tools for representing long chains of parallel and serial jobs
|
99
113
|
in a flat, simple way.
|
100
114
|
email:
|
@@ -117,6 +131,7 @@ files:
|
|
117
131
|
- bin/console
|
118
132
|
- bin/setup
|
119
133
|
- lib/simplekiq.rb
|
134
|
+
- lib/simplekiq/batch_tracker_job.rb
|
120
135
|
- lib/simplekiq/batching_job.rb
|
121
136
|
- lib/simplekiq/orchestration.rb
|
122
137
|
- lib/simplekiq/orchestration_executor.rb
|
@@ -124,34 +139,6 @@ files:
|
|
124
139
|
- lib/simplekiq/version.rb
|
125
140
|
- simplekiq.gemspec
|
126
141
|
- tasks/ci.rake
|
127
|
-
- vendor/cache/ast-2.4.2.gem
|
128
|
-
- vendor/cache/coderay-1.1.3.gem
|
129
|
-
- vendor/cache/connection_pool-2.2.5.gem
|
130
|
-
- vendor/cache/diff-lcs-1.5.0.gem
|
131
|
-
- vendor/cache/method_source-1.0.0.gem
|
132
|
-
- vendor/cache/parallel-1.22.1.gem
|
133
|
-
- vendor/cache/parser-3.1.1.0.gem
|
134
|
-
- vendor/cache/pry-0.13.1.gem
|
135
|
-
- vendor/cache/rack-2.2.3.gem
|
136
|
-
- vendor/cache/rack-protection-2.2.0.gem
|
137
|
-
- vendor/cache/rainbow-3.1.1.gem
|
138
|
-
- vendor/cache/rake-12.3.3.gem
|
139
|
-
- vendor/cache/redis-4.5.1.gem
|
140
|
-
- vendor/cache/regexp_parser-2.2.1.gem
|
141
|
-
- vendor/cache/rexml-3.2.5.gem
|
142
|
-
- vendor/cache/rspec-3.10.0.gem
|
143
|
-
- vendor/cache/rspec-core-3.10.1.gem
|
144
|
-
- vendor/cache/rspec-expectations-3.10.1.gem
|
145
|
-
- vendor/cache/rspec-mocks-3.10.2.gem
|
146
|
-
- vendor/cache/rspec-support-3.10.3.gem
|
147
|
-
- vendor/cache/rspec_junit_formatter-0.5.1.gem
|
148
|
-
- vendor/cache/rubocop-1.26.1.gem
|
149
|
-
- vendor/cache/rubocop-ast-1.16.0.gem
|
150
|
-
- vendor/cache/rubocop-performance-1.13.3.gem
|
151
|
-
- vendor/cache/ruby-progressbar-1.11.0.gem
|
152
|
-
- vendor/cache/sidekiq-5.2.10.gem
|
153
|
-
- vendor/cache/standard-1.9.1.gem
|
154
|
-
- vendor/cache/unicode-display_width-2.1.0.gem
|
155
142
|
homepage: https://github.com/doximity/simplekiq
|
156
143
|
licenses:
|
157
144
|
- APACHE-2.0
|
data/vendor/cache/ast-2.4.2.gem
DELETED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/vendor/cache/pry-0.13.1.gem
DELETED
Binary file
|
data/vendor/cache/rack-2.2.3.gem
DELETED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|