cloudtasker 0.5.0 → 0.6.0
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/CHANGELOG.md +25 -0
- data/Gemfile.lock +18 -1
- data/README.md +26 -5
- data/Rakefile +6 -0
- data/app/controllers/cloudtasker/worker_controller.rb +8 -6
- data/cloudtasker.gemspec +3 -2
- data/lib/cloudtasker/version.rb +1 -1
- metadata +18 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8721e878a098657f0c3974670df6373c873d1df2fa1042b97d9b37d7a1118299
|
|
4
|
+
data.tar.gz: ffd5652b0220a833f603682fdb4392a850b13b185bd7516dd170f5314d1b4af6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f0f98ff0e0062b28be192f8353363a736f5cb315eb14f86f577586de070127642d123617e8e831dea84271cada640ea3b9ec642ea75f3f9a12cd494432b9e178
|
|
7
|
+
data.tar.gz: a04500924970efdbc0ceb9364314e0426c92800a4c571b839432de5b9f2faa04e678a67186b0dfd2b32222e8d8606e39ce51b0922ba9687ea827271174dcb23d
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [v0.5.0](https://github.com/keypup-io/cloudtasker/tree/v0.5.0) (2019-11-25)
|
|
4
|
+
|
|
5
|
+
[Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.4.0...v0.5.0)
|
|
6
|
+
|
|
7
|
+
## [v0.4.0](https://github.com/keypup-io/cloudtasker/tree/v0.4.0) (2019-11-25)
|
|
8
|
+
|
|
9
|
+
[Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.3.0...v0.4.0)
|
|
10
|
+
|
|
11
|
+
## [v0.3.0](https://github.com/keypup-io/cloudtasker/tree/v0.3.0) (2019-11-25)
|
|
12
|
+
|
|
13
|
+
[Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.2.0...v0.3.0)
|
|
14
|
+
|
|
15
|
+
## [v0.2.0](https://github.com/keypup-io/cloudtasker/tree/v0.2.0) (2019-11-18)
|
|
16
|
+
|
|
17
|
+
[Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.1.0...v0.2.0)
|
|
18
|
+
|
|
19
|
+
## [v0.1.0](https://github.com/keypup-io/cloudtasker/tree/v0.1.0) (2019-11-17)
|
|
20
|
+
|
|
21
|
+
[Full Changelog](https://github.com/keypup-io/cloudtasker/compare/c137feb1ceaaaa4e2fecac0d1f0b4c73151ae002...v0.1.0)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
cloudtasker (0.
|
|
4
|
+
cloudtasker (0.6.0)
|
|
5
5
|
activesupport
|
|
6
6
|
fugit
|
|
7
7
|
google-cloud-tasks
|
|
@@ -84,9 +84,19 @@ GEM
|
|
|
84
84
|
tzinfo
|
|
85
85
|
faraday (0.17.0)
|
|
86
86
|
multipart-post (>= 1.2, < 3)
|
|
87
|
+
faraday-http-cache (2.0.0)
|
|
88
|
+
faraday (~> 0.8)
|
|
87
89
|
fugit (1.3.3)
|
|
88
90
|
et-orbi (~> 1.1, >= 1.1.8)
|
|
89
91
|
raabro (~> 1.1)
|
|
92
|
+
github_changelog_generator (1.15.0)
|
|
93
|
+
activesupport
|
|
94
|
+
faraday-http-cache
|
|
95
|
+
multi_json
|
|
96
|
+
octokit (~> 4.6)
|
|
97
|
+
rainbow (>= 2.2.1)
|
|
98
|
+
rake (>= 10.0)
|
|
99
|
+
retriable (~> 3.0)
|
|
90
100
|
globalid (0.4.2)
|
|
91
101
|
activesupport (>= 4.2.0)
|
|
92
102
|
google-cloud-tasks (1.3.1)
|
|
@@ -143,6 +153,8 @@ GEM
|
|
|
143
153
|
nio4r (2.5.2)
|
|
144
154
|
nokogiri (1.10.5)
|
|
145
155
|
mini_portile2 (~> 2.4.0)
|
|
156
|
+
octokit (4.14.0)
|
|
157
|
+
sawyer (~> 0.8.0, >= 0.5.3)
|
|
146
158
|
os (1.0.1)
|
|
147
159
|
parallel (1.18.0)
|
|
148
160
|
parser (2.6.5.0)
|
|
@@ -181,6 +193,7 @@ GEM
|
|
|
181
193
|
rainbow (3.0.0)
|
|
182
194
|
rake (10.5.0)
|
|
183
195
|
redis (4.1.3)
|
|
196
|
+
retriable (3.1.2)
|
|
184
197
|
rly (0.2.3)
|
|
185
198
|
rspec (3.9.0)
|
|
186
199
|
rspec-core (~> 3.9.0)
|
|
@@ -214,6 +227,9 @@ GEM
|
|
|
214
227
|
rubocop (>= 0.68.1)
|
|
215
228
|
ruby-progressbar (1.10.1)
|
|
216
229
|
safe_yaml (1.0.5)
|
|
230
|
+
sawyer (0.8.2)
|
|
231
|
+
addressable (>= 2.3.5)
|
|
232
|
+
faraday (> 0.8, < 2.0)
|
|
217
233
|
signet (0.12.0)
|
|
218
234
|
addressable (~> 2.3)
|
|
219
235
|
faraday (~> 0.9)
|
|
@@ -249,6 +265,7 @@ DEPENDENCIES
|
|
|
249
265
|
appraisal
|
|
250
266
|
bundler (~> 2.0)
|
|
251
267
|
cloudtasker!
|
|
268
|
+
github_changelog_generator
|
|
252
269
|
rails
|
|
253
270
|
rake (~> 10.0)
|
|
254
271
|
rspec (~> 3.0)
|
data/README.md
CHANGED
|
@@ -10,6 +10,27 @@ Cloudtasker also provides optional modules for running [cron jobs](docs/CRON_JOB
|
|
|
10
10
|
|
|
11
11
|
A local processing server is also available in development. This local server processes jobs in lieu of Cloud Tasks and allow you to work offline.
|
|
12
12
|
|
|
13
|
+
## Summary
|
|
14
|
+
|
|
15
|
+
1. [Installation](#installation)
|
|
16
|
+
2. [Get started with Rails](#get-started-with-rails)
|
|
17
|
+
3. [Configuring Cloudtasker](#configuring-cloudtasker)
|
|
18
|
+
1. [Cloud Tasks authentication & permissions](#cloud-tasks-authentication--permissions)
|
|
19
|
+
2. [Cloudtasker initializer](#cloudtasker-initializer)
|
|
20
|
+
4. [Enqueuing jobs](#enqueuing-jobs)
|
|
21
|
+
5. [Extensions](#extensions)
|
|
22
|
+
6. [Working locally](#working-locally)
|
|
23
|
+
1. [Option 1: Cloudtasker local server](#option-1-cloudtasker-local-server)
|
|
24
|
+
2. [Option 2: Using ngrok](#option-2-using-ngrok)
|
|
25
|
+
7. [Logging](#logging)
|
|
26
|
+
1. [Configuring a logger](#configuring-a-logger)
|
|
27
|
+
2. [Logging context](#logging-context)
|
|
28
|
+
8. [Error Handling](#error-handling)
|
|
29
|
+
1. [HTTP Error codes](#http-error-codes)
|
|
30
|
+
2. [Error callbacks](#error-callbacks)
|
|
31
|
+
3. [Max retries](#max-retries)
|
|
32
|
+
9. [Best practices building workers](#best-practices-building-workers)
|
|
33
|
+
|
|
13
34
|
## Installation
|
|
14
35
|
|
|
15
36
|
Add this line to your application's Gemfile:
|
|
@@ -77,7 +98,7 @@ Launch Rails and the local Cloudtasker processing server (or add `cloudtasker` t
|
|
|
77
98
|
> cloudtasker
|
|
78
99
|
```
|
|
79
100
|
|
|
80
|
-
Open a Rails console and enqueue
|
|
101
|
+
Open a Rails console and enqueue some jobs
|
|
81
102
|
```ruby
|
|
82
103
|
# Process job as soon as possible
|
|
83
104
|
DummyWorker.perform_async('foo')
|
|
@@ -290,7 +311,7 @@ Want to test your application end to end with Google Cloud Task? Then [ngrok](ht
|
|
|
290
311
|
|
|
291
312
|
First start your ngrok tunnel and take note of the :
|
|
292
313
|
```bash
|
|
293
|
-
ngrok
|
|
314
|
+
ngrok http 3000
|
|
294
315
|
```
|
|
295
316
|
|
|
296
317
|
Take note of your ngrok domain and configure Cloudtasker to use Google Cloud Task in development via ngrok.
|
|
@@ -394,7 +415,7 @@ Jobs failing will automatically return an HTTP error to Cloud Task and trigger a
|
|
|
394
415
|
Jobs failing will automatically return the following HTTP error code to Cloud Tasks, based on the actual reason:
|
|
395
416
|
|
|
396
417
|
| Code | Description |
|
|
397
|
-
|
|
418
|
+
|------|-------------|
|
|
398
419
|
| 205 | The job is dead and has been removed from the queue |
|
|
399
420
|
| 404 | The job has specified an incorrect worker class. |
|
|
400
421
|
| 422 | An error happened during the execution of the worker (`perform` method) |
|
|
@@ -574,7 +595,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
|
574
595
|
|
|
575
596
|
## Contributing
|
|
576
597
|
|
|
577
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
|
598
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/keypup-io/cloudtasker. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
578
599
|
|
|
579
600
|
## License
|
|
580
601
|
|
|
@@ -582,7 +603,7 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
|
582
603
|
|
|
583
604
|
## Code of Conduct
|
|
584
605
|
|
|
585
|
-
Everyone interacting in the Cloudtasker project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
|
606
|
+
Everyone interacting in the Cloudtasker project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/keypup-io/cloudtasker/blob/master/CODE_OF_CONDUCT.md).
|
|
586
607
|
|
|
587
608
|
## Author
|
|
588
609
|
|
data/Rakefile
CHANGED
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
require 'bundler/gem_tasks'
|
|
4
4
|
require 'rspec/core/rake_task'
|
|
5
|
+
require 'github_changelog_generator/task'
|
|
5
6
|
|
|
6
7
|
RSpec::Core::RakeTask.new(:spec)
|
|
7
8
|
|
|
8
9
|
task default: :spec
|
|
10
|
+
|
|
11
|
+
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
|
12
|
+
config.user = 'keypup-io'
|
|
13
|
+
config.project = 'cloudtasker'
|
|
14
|
+
end
|
|
@@ -16,13 +16,15 @@ module Cloudtasker
|
|
|
16
16
|
# Run a worker from a Cloud Task payload
|
|
17
17
|
#
|
|
18
18
|
def run
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
# Build payload
|
|
20
|
+
payload = request.params
|
|
21
|
+
.slice(:worker, :job_id, :job_args, :job_meta)
|
|
22
|
+
.merge(job_retries: job_retries)
|
|
23
|
+
|
|
24
|
+
# Process payload
|
|
25
|
+
WorkerHandler.execute_from_payload!(payload)
|
|
24
26
|
head :no_content
|
|
25
|
-
rescue
|
|
27
|
+
rescue DeadWorkerError
|
|
26
28
|
# 205: job will NOT be retried
|
|
27
29
|
head :reset_content
|
|
28
30
|
rescue InvalidWorkerError
|
data/cloudtasker.gemspec
CHANGED
|
@@ -10,8 +10,8 @@ Gem::Specification.new do |spec|
|
|
|
10
10
|
spec.authors = ['Arnaud Lachaume']
|
|
11
11
|
spec.email = ['arnaud.lachaume@keypup.io']
|
|
12
12
|
|
|
13
|
-
spec.summary = '
|
|
14
|
-
spec.description = '
|
|
13
|
+
spec.summary = 'Background jobs for Ruby using Google Cloud Tasks (alpha)'
|
|
14
|
+
spec.description = 'Background jobs for Ruby using Google Cloud Tasks (alpha)'
|
|
15
15
|
spec.homepage = 'https://github.com/keypup-io/cloudtasker'
|
|
16
16
|
spec.license = 'MIT'
|
|
17
17
|
|
|
@@ -38,6 +38,7 @@ 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'
|
|
41
42
|
spec.add_development_dependency 'rake', '~> 10.0'
|
|
42
43
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
|
43
44
|
spec.add_development_dependency 'rubocop', '0.76.0'
|
data/lib/cloudtasker/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cloudtasker
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Arnaud Lachaume
|
|
@@ -108,6 +108,20 @@ dependencies:
|
|
|
108
108
|
- - "~>"
|
|
109
109
|
- !ruby/object:Gem::Version
|
|
110
110
|
version: '2.0'
|
|
111
|
+
- !ruby/object:Gem::Dependency
|
|
112
|
+
name: github_changelog_generator
|
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - ">="
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: '0'
|
|
118
|
+
type: :development
|
|
119
|
+
prerelease: false
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - ">="
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: '0'
|
|
111
125
|
- !ruby/object:Gem::Dependency
|
|
112
126
|
name: rake
|
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -234,7 +248,7 @@ dependencies:
|
|
|
234
248
|
- - ">="
|
|
235
249
|
- !ruby/object:Gem::Version
|
|
236
250
|
version: '0'
|
|
237
|
-
description:
|
|
251
|
+
description: Background jobs for Ruby using Google Cloud Tasks (alpha)
|
|
238
252
|
email:
|
|
239
253
|
- arnaud.lachaume@keypup.io
|
|
240
254
|
executables:
|
|
@@ -247,6 +261,7 @@ files:
|
|
|
247
261
|
- ".rubocop.yml"
|
|
248
262
|
- ".travis.yml"
|
|
249
263
|
- Appraisals
|
|
264
|
+
- CHANGELOG.md
|
|
250
265
|
- CODE_OF_CONDUCT.md
|
|
251
266
|
- Gemfile
|
|
252
267
|
- Gemfile.lock
|
|
@@ -356,5 +371,5 @@ rubyforge_project:
|
|
|
356
371
|
rubygems_version: 2.7.9
|
|
357
372
|
signing_key:
|
|
358
373
|
specification_version: 4
|
|
359
|
-
summary:
|
|
374
|
+
summary: Background jobs for Ruby using Google Cloud Tasks (alpha)
|
|
360
375
|
test_files: []
|