cloudtasker 0.12.rc11 → 0.13.rc1
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/.github/workflows/lint_rubocop.yml +20 -0
- data/.github/workflows/{test.yml → test_ruby_2.5_2.6.yml} +8 -13
- data/.github/workflows/test_ruby_2.7.yml +40 -0
- data/.github/workflows/test_ruby_3.x.yml +39 -0
- data/.rubocop.yml +5 -0
- data/Appraisals +20 -0
- data/CHANGELOG.md +52 -3
- data/README.md +15 -7
- data/Rakefile +0 -6
- data/app/controllers/cloudtasker/worker_controller.rb +4 -1
- data/cloudtasker.gemspec +0 -5
- data/docs/BATCH_JOBS.md +2 -2
- data/docs/CRON_JOBS.md +39 -0
- data/gemfiles/google_cloud_tasks_1.0.gemfile +1 -0
- data/gemfiles/google_cloud_tasks_1.0.gemfile.lock +43 -205
- data/gemfiles/google_cloud_tasks_1.1.gemfile +1 -0
- data/gemfiles/google_cloud_tasks_1.1.gemfile.lock +43 -205
- data/gemfiles/google_cloud_tasks_1.2.gemfile +1 -0
- data/gemfiles/google_cloud_tasks_1.2.gemfile.lock +43 -205
- data/gemfiles/google_cloud_tasks_1.3.gemfile +1 -0
- data/gemfiles/google_cloud_tasks_1.3.gemfile.lock +43 -205
- data/gemfiles/rails_5.2.gemfile +1 -0
- data/gemfiles/rails_5.2.gemfile.lock +54 -96
- data/gemfiles/rails_6.0.gemfile +1 -0
- data/gemfiles/rails_6.0.gemfile.lock +55 -97
- data/gemfiles/rails_6.1.gemfile +8 -0
- data/gemfiles/rails_7.0.gemfile +8 -0
- data/gemfiles/semantic_logger_3.4.gemfile +1 -0
- data/gemfiles/semantic_logger_4.6.gemfile +1 -0
- data/gemfiles/semantic_logger_4.7.0.gemfile +1 -0
- data/gemfiles/semantic_logger_4.7.2.gemfile +1 -0
- data/lib/cloudtasker/backend/google_cloud_task.rb +12 -8
- data/lib/cloudtasker/backend/memory_task.rb +1 -1
- data/lib/cloudtasker/backend/redis_task.rb +7 -3
- data/lib/cloudtasker/cloud_task.rb +2 -2
- data/lib/cloudtasker/cron/schedule.rb +7 -7
- data/lib/cloudtasker/local_server.rb +1 -1
- data/lib/cloudtasker/redis_client.rb +39 -14
- data/lib/cloudtasker/unique_job/job.rb +3 -2
- data/lib/cloudtasker/unique_job/middleware/client.rb +2 -1
- data/lib/cloudtasker/version.rb +1 -1
- data/lib/cloudtasker/worker.rb +4 -4
- data/lib/cloudtasker/worker_wrapper.rb +1 -1
- data/lib/cloudtasker.rb +1 -0
- metadata +9 -61
- data/app/controllers/cloudtasker/application_controller.rb +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bad50ce6f1fb0a4293c26d53530b47dae74a577f7bcddaa9a3d3092e5baeec56
|
4
|
+
data.tar.gz: 484a11cbfb894334d2b3dc17bbf06877a0b4002852066d197fd0e038dbe8918e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c865c34712cdc8fc97d33563a1450daa9705d75458687c04e74e15f26e7180f8534e107c6994e6402de703a3b7060fbc29f1a0e1f00c2361084f3613dfbb9ae5
|
7
|
+
data.tar.gz: 31fd6ebc1b253db4f6accd747ae871c97d521c089b7682ac0755be8c0a4a17ea504c4b38db9fd84a35a8cdd78f407714e266a58d3a8f19919abbed8ea5378ebb
|
@@ -0,0 +1,20 @@
|
|
1
|
+
name: Rubocop
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
steps:
|
9
|
+
- uses: actions/checkout@v2
|
10
|
+
- uses: zhulik/redis-action@1.1.0
|
11
|
+
- name: Set up Ruby
|
12
|
+
uses: ruby/setup-ruby@v1
|
13
|
+
with:
|
14
|
+
ruby-version: '3.0.1'
|
15
|
+
bundler-cache: true
|
16
|
+
- name: Lint codebase
|
17
|
+
run: |
|
18
|
+
gem install bundler
|
19
|
+
bundle install --jobs 4 --retry 3
|
20
|
+
bundle exec rubocop
|
@@ -1,10 +1,6 @@
|
|
1
|
-
name:
|
1
|
+
name: Ruby 2.5/2.6
|
2
2
|
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
branches: [ master, 0.9-stable ]
|
6
|
-
pull_request:
|
7
|
-
branches: [ master, 0.9-stable ]
|
3
|
+
on: [push, pull_request]
|
8
4
|
|
9
5
|
jobs:
|
10
6
|
build:
|
@@ -12,8 +8,8 @@ jobs:
|
|
12
8
|
strategy:
|
13
9
|
matrix:
|
14
10
|
ruby:
|
15
|
-
- '2.5.
|
16
|
-
- '2.6.
|
11
|
+
- '2.5.9'
|
12
|
+
- '2.6.7'
|
17
13
|
appraisal:
|
18
14
|
- 'google-cloud-tasks-1.0'
|
19
15
|
- 'google-cloud-tasks-1.1'
|
@@ -21,25 +17,24 @@ jobs:
|
|
21
17
|
- 'google-cloud-tasks-1.3'
|
22
18
|
- 'rails-5.2'
|
23
19
|
- 'rails-6.0'
|
20
|
+
- 'rails-6.1'
|
24
21
|
- 'semantic_logger-3.4'
|
25
22
|
- 'semantic_logger-4.6'
|
26
23
|
- 'semantic_logger-4.7.0'
|
27
24
|
- 'semantic_logger-4.7.2'
|
28
25
|
steps:
|
29
|
-
- name: Setup System
|
30
|
-
run: sudo apt-get install libsqlite3-dev
|
31
26
|
- uses: actions/checkout@v2
|
32
27
|
- uses: zhulik/redis-action@1.1.0
|
33
|
-
- name: Set up Ruby
|
34
|
-
uses:
|
28
|
+
- name: Set up Ruby
|
29
|
+
uses: ruby/setup-ruby@v1
|
35
30
|
with:
|
36
31
|
ruby-version: ${{ matrix.ruby }}
|
32
|
+
bundler-cache: true
|
37
33
|
- name: Build and test with Rake
|
38
34
|
env:
|
39
35
|
APPRAISAL_CONTEXT: ${{ matrix.appraisal }}
|
40
36
|
run: |
|
41
37
|
gem install bundler
|
42
38
|
bundle install --jobs 4 --retry 3
|
43
|
-
bundle exec rubocop
|
44
39
|
bundle exec appraisal ${APPRAISAL_CONTEXT} bundle
|
45
40
|
bundle exec appraisal ${APPRAISAL_CONTEXT} rspec
|
@@ -0,0 +1,40 @@
|
|
1
|
+
name: Ruby 2.7
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
strategy:
|
9
|
+
matrix:
|
10
|
+
ruby:
|
11
|
+
- '2.7.5'
|
12
|
+
appraisal:
|
13
|
+
- 'google-cloud-tasks-1.0'
|
14
|
+
- 'google-cloud-tasks-1.1'
|
15
|
+
- 'google-cloud-tasks-1.2'
|
16
|
+
- 'google-cloud-tasks-1.3'
|
17
|
+
- 'rails-5.2'
|
18
|
+
- 'rails-6.0'
|
19
|
+
- 'rails-6.1'
|
20
|
+
- 'rails-7.0'
|
21
|
+
- 'semantic_logger-3.4'
|
22
|
+
- 'semantic_logger-4.6'
|
23
|
+
- 'semantic_logger-4.7.0'
|
24
|
+
- 'semantic_logger-4.7.2'
|
25
|
+
steps:
|
26
|
+
- uses: actions/checkout@v2
|
27
|
+
- uses: zhulik/redis-action@1.1.0
|
28
|
+
- name: Set up Ruby
|
29
|
+
uses: ruby/setup-ruby@v1
|
30
|
+
with:
|
31
|
+
ruby-version: ${{ matrix.ruby }}
|
32
|
+
bundler-cache: true
|
33
|
+
- name: Build and test with Rake
|
34
|
+
env:
|
35
|
+
APPRAISAL_CONTEXT: ${{ matrix.appraisal }}
|
36
|
+
run: |
|
37
|
+
gem install bundler
|
38
|
+
bundle install --jobs 4 --retry 3
|
39
|
+
bundle exec appraisal ${APPRAISAL_CONTEXT} bundle
|
40
|
+
bundle exec appraisal ${APPRAISAL_CONTEXT} rspec
|
@@ -0,0 +1,39 @@
|
|
1
|
+
name: Ruby 3.x
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
strategy:
|
9
|
+
matrix:
|
10
|
+
ruby:
|
11
|
+
- '3.0.1'
|
12
|
+
- '3.1.0'
|
13
|
+
appraisal:
|
14
|
+
- 'google-cloud-tasks-1.0'
|
15
|
+
- 'google-cloud-tasks-1.1'
|
16
|
+
- 'google-cloud-tasks-1.2'
|
17
|
+
- 'google-cloud-tasks-1.3'
|
18
|
+
- 'rails-6.1'
|
19
|
+
- 'rails-7.0'
|
20
|
+
- 'semantic_logger-3.4'
|
21
|
+
- 'semantic_logger-4.6'
|
22
|
+
- 'semantic_logger-4.7.0'
|
23
|
+
- 'semantic_logger-4.7.2'
|
24
|
+
steps:
|
25
|
+
- uses: actions/checkout@v2
|
26
|
+
- uses: zhulik/redis-action@1.1.0
|
27
|
+
- name: Set up Ruby
|
28
|
+
uses: ruby/setup-ruby@v1
|
29
|
+
with:
|
30
|
+
ruby-version: ${{ matrix.ruby }}
|
31
|
+
bundler-cache: true
|
32
|
+
- name: Build and test with Rake
|
33
|
+
env:
|
34
|
+
APPRAISAL_CONTEXT: ${{ matrix.appraisal }}
|
35
|
+
run: |
|
36
|
+
gem install bundler
|
37
|
+
bundle install --jobs 4 --retry 3
|
38
|
+
bundle exec appraisal ${APPRAISAL_CONTEXT} bundle
|
39
|
+
bundle exec appraisal ${APPRAISAL_CONTEXT} rspec
|
data/.rubocop.yml
CHANGED
@@ -5,6 +5,11 @@ AllCops:
|
|
5
5
|
- 'gemfiles/**/*'
|
6
6
|
- 'vendor/**/*'
|
7
7
|
|
8
|
+
# Ruby 3.0: curly braces around last argument has meaning
|
9
|
+
# See: https://github.com/rubocop/rubocop/issues/7641
|
10
|
+
Style/BracesAroundHashParameters:
|
11
|
+
Enabled: false
|
12
|
+
|
8
13
|
Metrics/ClassLength:
|
9
14
|
Max: 200
|
10
15
|
|
data/Appraisals
CHANGED
@@ -1,41 +1,61 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
appraise 'google-cloud-tasks-1.0' do
|
4
|
+
gem 'activesupport', '6.1' # ruby 2.5 / 2.6 compatibility
|
4
5
|
gem 'google-cloud-tasks', '1.0'
|
5
6
|
end
|
6
7
|
|
7
8
|
appraise 'google-cloud-tasks-1.1' do
|
9
|
+
gem 'activesupport', '6.1' # ruby 2.5 / 2.6 compatibility
|
8
10
|
gem 'google-cloud-tasks', '1.1'
|
9
11
|
end
|
10
12
|
|
11
13
|
appraise 'google-cloud-tasks-1.2' do
|
14
|
+
gem 'activesupport', '6.1' # ruby 2.5 / 2.6 compatibility
|
12
15
|
gem 'google-cloud-tasks', '1.2'
|
13
16
|
end
|
14
17
|
|
15
18
|
appraise 'google-cloud-tasks-1.3' do
|
19
|
+
gem 'activesupport', '6.1' # ruby 2.5 / 2.6 compatibility
|
16
20
|
gem 'google-cloud-tasks', '1.3'
|
17
21
|
end
|
18
22
|
|
19
23
|
appraise 'rails-5.2' do
|
20
24
|
gem 'rails', '5.2'
|
25
|
+
gem 'rspec-rails'
|
21
26
|
end
|
22
27
|
|
23
28
|
appraise 'rails-6.0' do
|
24
29
|
gem 'rails', '6.0'
|
30
|
+
gem 'rspec-rails'
|
31
|
+
end
|
32
|
+
|
33
|
+
appraise 'rails-6.1' do
|
34
|
+
gem 'rails', '6.1'
|
35
|
+
gem 'rspec-rails'
|
36
|
+
end
|
37
|
+
|
38
|
+
appraise 'rails-7.0' do
|
39
|
+
gem 'rails', '7.0'
|
40
|
+
gem 'rspec-rails'
|
25
41
|
end
|
26
42
|
|
27
43
|
appraise 'semantic_logger-3.4' do
|
44
|
+
gem 'activesupport', '6.1' # ruby 2.5 / 2.6 compatibility
|
28
45
|
gem 'semantic_logger', '3.4.1'
|
29
46
|
end
|
30
47
|
|
31
48
|
appraise 'semantic_logger-4.6' do
|
49
|
+
gem 'activesupport', '6.1' # ruby 2.5 / 2.6 compatibility
|
32
50
|
gem 'semantic_logger', '4.6.1'
|
33
51
|
end
|
34
52
|
|
35
53
|
appraise 'semantic_logger-4.7.0' do
|
54
|
+
gem 'activesupport', '6.1' # ruby 2.5 / 2.6 compatibility
|
36
55
|
gem 'semantic_logger', '4.7.0'
|
37
56
|
end
|
38
57
|
|
39
58
|
appraise 'semantic_logger-4.7.2' do
|
59
|
+
gem 'activesupport', '6.1' # ruby 2.5 / 2.6 compatibility
|
40
60
|
gem 'semantic_logger', '4.7.2'
|
41
61
|
end
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,57 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
##
|
3
|
+
## [v0.13.rc1](https://github.com/keypup-io/cloudtasker/tree/v0.13.rc1) (2022-01-03)
|
4
4
|
|
5
|
-
[Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.
|
5
|
+
[Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.12.2...v0.13.rc1)
|
6
|
+
|
7
|
+
**Improvements:**
|
8
|
+
- Ruby 3: Rework method arguments to be compatible with Ruby 3
|
9
|
+
- Tests: Separate test environment for Ruby 2 and Ruby 3
|
10
|
+
- Tests: Do not load Rails by default and skip Rails-specific tests in non-Rails appraisals
|
11
|
+
|
12
|
+
## [v0.12.2](https://github.com/keypup-io/cloudtasker/tree/v0.12.2) (2021-12-31)
|
13
|
+
|
14
|
+
[Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.12.1...v0.12.2)
|
15
|
+
|
16
|
+
**Fixed bugs:**
|
17
|
+
- Local server: Fix race condition on thread processing. See [#46](https://github.com/keypup-io/cloudtasker/pull/46)
|
18
|
+
- Non-Rails: Fix `arguments_missing?` check for non-rails projects.
|
19
|
+
|
20
|
+
## [v0.12.1](https://github.com/keypup-io/cloudtasker/tree/v0.12.1) (2021-08-25)
|
21
|
+
|
22
|
+
[Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.12.0...v0.12.1)
|
23
|
+
|
24
|
+
**Fixed bugs:**
|
25
|
+
- Dependencies: Require `try` from `activesupport`. This was preventing non-Rails projects from properly running Cloudtasker jobs.
|
26
|
+
- WorkerController: remove useless inheritance from local ApplicationController. The parent controller was not always loaded on Rails 5 which in turn created issues with authenticity token. Fixes [#40](https://github.com/keypup-io/cloudtasker/issues/40)
|
27
|
+
|
28
|
+
## [v0.11.1](https://github.com/keypup-io/cloudtasker/tree/v0.11.1) (2021-08-25)
|
29
|
+
|
30
|
+
[Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.11.0...v0.11.1)
|
31
|
+
|
32
|
+
**Fixed bugs:**
|
33
|
+
- Dependencies: Require `try` from `activesupport`. This was preventing non-Rails projects from properly running Cloudtasker jobs.
|
34
|
+
- WorkerController: remove useless inheritance from local ApplicationController. The parent controller was not always loaded on Rails 5 which in turn created issues with authenticity token. Fixes [#40](https://github.com/keypup-io/cloudtasker/issues/40)
|
35
|
+
|
36
|
+
## [v0.10.2](https://github.com/keypup-io/cloudtasker/tree/v0.10.2) (2021-08-25)
|
37
|
+
|
38
|
+
[Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.10.1...v0.10.2)
|
39
|
+
|
40
|
+
**Fixed bugs:**
|
41
|
+
- Dependencies: Require `try` from `activesupport`. This was preventing non-Rails projects from properly running Cloudtasker jobs.
|
42
|
+
- WorkerController: remove useless inheritance from local ApplicationController. The parent controller was not always loaded on Rails 5 which in turn created issues with authenticity token. Fixes [#40](https://github.com/keypup-io/cloudtasker/issues/40)
|
43
|
+
|
44
|
+
## [v0.9.5](https://github.com/keypup-io/cloudtasker/tree/v0.9.5) (2021-08-25)
|
45
|
+
|
46
|
+
[Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.9.4...v0.9.5)
|
47
|
+
|
48
|
+
**Fixed bugs:**
|
49
|
+
- Dependencies: Require `try` from `activesupport`. This was preventing non-Rails projects from properly running Cloudtasker jobs.
|
50
|
+
- WorkerController: remove useless inheritance from local ApplicationController. The parent controller was not always loaded on Rails 5 which in turn created issues with authenticity token. Fixes [#40](https://github.com/keypup-io/cloudtasker/issues/40)
|
51
|
+
|
52
|
+
## [v0.12.0](https://github.com/keypup-io/cloudtasker/tree/v0.12.0) (2021-08-19)
|
53
|
+
|
54
|
+
[Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.11.0...v0.12.0)
|
6
55
|
|
7
56
|
**Improvements:**
|
8
57
|
- ActiveJob: do not double log errors (ActiveJob has its own error logging)
|
@@ -25,7 +74,7 @@
|
|
25
74
|
**Fixed bugs:**
|
26
75
|
- Retries: Enforce job retry limit on job processing. There was an edge case where jobs could be retried indefinitely on batch callback errors.
|
27
76
|
|
28
|
-
## [v0.11.0](https://github.com/keypup-io/cloudtasker/tree/v0.11.0) (
|
77
|
+
## [v0.11.0](https://github.com/keypup-io/cloudtasker/tree/v0.11.0) (2020-11-23)
|
29
78
|
|
30
79
|
[Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.10.0...v0.11.0)
|
31
80
|
|
data/README.md
CHANGED
@@ -365,7 +365,7 @@ Cloudtasker.configure do |config|
|
|
365
365
|
# This option can also be configured on a per worker basis via
|
366
366
|
# the cloudtasker_options directive.
|
367
367
|
#
|
368
|
-
# Supported since: v0.12.
|
368
|
+
# Supported since: v0.12.0
|
369
369
|
#
|
370
370
|
# Default: 600 seconds (10 minutes)
|
371
371
|
#
|
@@ -382,7 +382,7 @@ Cloudtasker.configure do |config|
|
|
382
382
|
#
|
383
383
|
# Note: the worker argument might be nil, such as when InvalidWorkerError is raised.
|
384
384
|
#
|
385
|
-
# Supported since: v0.12.
|
385
|
+
# Supported since: v0.12.0
|
386
386
|
#
|
387
387
|
# Default: no operation
|
388
388
|
#
|
@@ -395,7 +395,7 @@ Cloudtasker.configure do |config|
|
|
395
395
|
# This is useful when you need to apply general exception handling, such
|
396
396
|
# logging specific messages/context when a job dies.
|
397
397
|
#
|
398
|
-
# Supported since: v0.12.
|
398
|
+
# Supported since: v0.12.0
|
399
399
|
#
|
400
400
|
# Default: no operation
|
401
401
|
#
|
@@ -709,7 +709,7 @@ end
|
|
709
709
|
```
|
710
710
|
|
711
711
|
### Global callbacks
|
712
|
-
**Supported since**: `0.12.
|
712
|
+
**Supported since**: `0.12.0`
|
713
713
|
|
714
714
|
If you need to apply general exception handling logic to your workers you can specify `on_error` and `on_dead` hooks in the Cloudtasker configuration.
|
715
715
|
|
@@ -790,7 +790,7 @@ end
|
|
790
790
|
```
|
791
791
|
|
792
792
|
### Dispatch deadline
|
793
|
-
**Supported since**: `0.12.
|
793
|
+
**Supported since**: `0.12.0`
|
794
794
|
|
795
795
|
By default Cloud Tasks will automatically timeout your jobs after 10 minutes, independently of your server HTTP timeout configuration.
|
796
796
|
|
@@ -1087,9 +1087,17 @@ To size the concurrency of your queues you should therefore take the most limiti
|
|
1087
1087
|
|
1088
1088
|
## Development
|
1089
1089
|
|
1090
|
-
After checking out the repo, run `bin/setup` to install dependencies.
|
1090
|
+
After checking out the repo, run `bin/setup` to install dependencies.
|
1091
1091
|
|
1092
|
-
|
1092
|
+
For tests, run `rake` to run the tests. Note that Rails is not in context by default, which means Rails-specific test will not run.
|
1093
|
+
For tests including Rails-specific tests, run `bundle exec appraisal rails-7.0 rake`
|
1094
|
+
For all context-specific tests (incl. Rails), run the [appraisal tests](Appraisals) using `bundle exec appraisal rake`.
|
1095
|
+
|
1096
|
+
You can run `bin/console` for an interactive prompt that will allow you to experiment.
|
1097
|
+
|
1098
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
1099
|
+
|
1100
|
+
To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
1093
1101
|
|
1094
1102
|
## Contributing
|
1095
1103
|
|
data/Rakefile
CHANGED
@@ -2,13 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'bundler/gem_tasks'
|
4
4
|
require 'rspec/core/rake_task'
|
5
|
-
require 'github_changelog_generator/task'
|
6
5
|
|
7
6
|
RSpec::Core::RakeTask.new(:spec)
|
8
7
|
|
9
8
|
task default: :spec
|
10
|
-
|
11
|
-
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
12
|
-
config.user = 'keypup-io'
|
13
|
-
config.project = 'cloudtasker'
|
14
|
-
end
|
@@ -2,7 +2,10 @@
|
|
2
2
|
|
3
3
|
module Cloudtasker
|
4
4
|
# Handle execution of workers
|
5
|
-
class WorkerController <
|
5
|
+
class WorkerController < ActionController::Base
|
6
|
+
# No need for CSRF verification on API endpoints
|
7
|
+
skip_before_action :verify_authenticity_token
|
8
|
+
|
6
9
|
# Authenticate all requests.
|
7
10
|
before_action :authenticate!
|
8
11
|
|
data/cloudtasker.gemspec
CHANGED
@@ -38,7 +38,6 @@ Gem::Specification.new do |spec|
|
|
38
38
|
|
39
39
|
spec.add_development_dependency 'appraisal'
|
40
40
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
41
|
-
spec.add_development_dependency 'github_changelog_generator'
|
42
41
|
spec.add_development_dependency 'rake', '>= 12.3.3'
|
43
42
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
44
43
|
spec.add_development_dependency 'rspec-json_expectations', '~> 2.2'
|
@@ -47,8 +46,4 @@ Gem::Specification.new do |spec|
|
|
47
46
|
spec.add_development_dependency 'semantic_logger'
|
48
47
|
spec.add_development_dependency 'timecop'
|
49
48
|
spec.add_development_dependency 'webmock'
|
50
|
-
|
51
|
-
spec.add_development_dependency 'rails'
|
52
|
-
spec.add_development_dependency 'rspec-rails'
|
53
|
-
spec.add_development_dependency 'sqlite3'
|
54
49
|
end
|
data/docs/BATCH_JOBS.md
CHANGED
@@ -48,7 +48,7 @@ end
|
|
48
48
|
```
|
49
49
|
|
50
50
|
## Example: Expanding the parent batch
|
51
|
-
**Note**: `parent_batch` is available since `0.12.
|
51
|
+
**Note**: `parent_batch` is available since `0.12.0`
|
52
52
|
|
53
53
|
```ruby
|
54
54
|
# All the jobs will be attached to the top parent batch.
|
@@ -123,7 +123,7 @@ def on_batch_node_complete(_child_job)
|
|
123
123
|
end
|
124
124
|
```
|
125
125
|
|
126
|
-
**Since:** `v0.12.
|
126
|
+
**Since:** `v0.12.0`
|
127
127
|
By default the `progress` method only considers the direct child jobs to evaluate the batch progress. You can pass `depth: somenumber` to the `progress` method to calculate the actual batch progress in a more granular way. Be careful however that this method recursively calculates progress on the sub-batches and is therefore expensive.
|
128
128
|
|
129
129
|
E.g.
|
data/docs/CRON_JOBS.md
CHANGED
@@ -65,3 +65,42 @@ if File.exist?(schedule_file) && !Rails.env.test?
|
|
65
65
|
end
|
66
66
|
```
|
67
67
|
|
68
|
+
## Limitations
|
69
|
+
GCP Cloud Tasks does not allow tasks to be scheduled more than 30 days (720h) in the future. Cron schedules should therefore be limited to 30 days intervals at most.
|
70
|
+
|
71
|
+
If you need to schedule a job to run on a monthly basis (e.g. on the first of the month), schedule this job to run every day then add the following logic in your job:
|
72
|
+
```ruby
|
73
|
+
#
|
74
|
+
# Cron schedule (8am UTC every day): 0 8 * * *
|
75
|
+
#
|
76
|
+
class MyMonthlyWorker
|
77
|
+
include Cloudtasker::Worker
|
78
|
+
|
79
|
+
def perform(*args)
|
80
|
+
# Abort unless we're the first of the month
|
81
|
+
return unless Time.current.day == 1
|
82
|
+
|
83
|
+
# ... job logic
|
84
|
+
end
|
85
|
+
end
|
86
|
+
```
|
87
|
+
|
88
|
+
The same approach can be used to schedule a job every quarter.
|
89
|
+
```ruby
|
90
|
+
#
|
91
|
+
# Cron schedule (8am UTC every day): 0 8 * * *
|
92
|
+
#
|
93
|
+
class MyQuarterlyWorker
|
94
|
+
include Cloudtasker::Worker
|
95
|
+
|
96
|
+
def perform(*args)
|
97
|
+
# Abort unless we're the first month of a quarter (Jan, Apr, Jul, Oct)
|
98
|
+
return unless Time.current.month == 1
|
99
|
+
|
100
|
+
# Abort unless we're the first of the month
|
101
|
+
return unless Time.current.day == 1
|
102
|
+
|
103
|
+
# ... job logic
|
104
|
+
end
|
105
|
+
end
|
106
|
+
```
|