rocketjob 6.0.0.rc2 → 6.0.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6568c1307b7d42a0968df0335e3177967a8223838eceecbe0b3c0cab72c398af
4
- data.tar.gz: 1109611ffce2fe4aed881f5bd9d017681546f06d62330ffc21873adbef12c179
3
+ metadata.gz: 6a04a33b0cd03bdf0a7cb948fc87dd6c7d7bb3b392e566a8c15df50b73e27459
4
+ data.tar.gz: fc62e740a0a92bae8daf1f4ffbe199af1debcb84f8859aed10ea5954dc44c7b6
5
5
  SHA512:
6
- metadata.gz: 073adf2196d6d0cfd5c06ad8776374a1a14618b5fbd49a550e9d8df587b0a17fd95b4dad34a60d8812a2c5f4046974e22bcf616512d77442ea28145d9bd374d2
7
- data.tar.gz: ee9b6d35149f7d7799071485f2e4032d47303d3452a4b7c70c5422019a66615938dba90e1e27090a4f33b635df6f565871efd3152f5a2f2a5cb03a61168b3755
6
+ metadata.gz: 74cac01d253cf21a856e1ca4a5cf63d5e90320303bdf310cf90325c9cca242c4ed1b7a0a1c43ca00764f2f40d29822df6e6bee499c1bff56c9ddaa2401bc3862
7
+ data.tar.gz: 1bbc47c7d869ef28fd578a7b2575f62957aa2f83f9fc927af1d6fba7866270b15fd21cef30007b78d58847137357c75ccae2d03545560d2ffe0d674fe34c1d0e
data/README.md CHANGED
@@ -17,21 +17,151 @@ Checkout https://rocketjob.io/
17
17
  * Questions? Join the chat room on Gitter for [rocketjob support](https://gitter.im/rocketjob/support)
18
18
  * [Report bugs](https://github.com/rocketjob/rocketjob/issues)
19
19
 
20
- ## Rocket Job v5
20
+ ## Rocket Job v6
21
21
 
22
22
  - Support for Ruby v3 and Rails 6.
23
- - Multiple output file support through extended `output_categories` capability.
24
- - File output formats for each category. For example: CSV, PSV, JSON, etc.
25
- - Support for AWS DocumentDB as the data store.
23
+ - Major enhancements in Batch job support:
24
+ - Direct built-in Tabular support for all input and output categories.
25
+ - Multiple output file support, each with its own settings for:
26
+ - Compression
27
+ - GZip, Zip, BZip2 (Chunked for much faster loading into Apache Spark).
28
+ - Encryption
29
+ - PGP, Symmetric Encryption.
30
+ - File format
31
+ - CSV, PSV, JSON, Fixed Format, xlsx.
32
+ - Significant error handling improvements, especially around throttle failures
33
+ that used to result in "hanging" jobs.
34
+ - Support AWS DocumentDB in addition to MongoDB as the data store.
26
35
  - Removed use of Symbols to meet Symbol deprecation in MongoDB and Mongoid.
27
36
 
28
- The following plugins have been deprecated and will be removed in Rocket Job v5.1
29
- - RocketJob::Batch::Tabular::Input
30
- - RocketJob::Batch::Tabular::Output
37
+ ### Upgrading to Rocket Job v6
38
+
39
+ The following plugins have been deprecated and are no longer loaded by default.
40
+ - `RocketJob::Batch::Tabular::Input`
41
+ - `RocketJob::Batch::Tabular::Output`
42
+
43
+ If your code relies on these plugins and you still want to upgrade to Rocket Job v6,
44
+ add the following require statement to any jobs that still use them:
45
+
46
+ ~~~ruby
47
+ require "rocket_job/batch/tabular"
48
+ ~~~
49
+
50
+ It is important to migrate away from these plugins, since they will be removed in a future release.
51
+
52
+ #### Upgrading Batch Jobs to Rocket Job v6
53
+
54
+ Rocket Job v6 replaces the array of symbol type for `input_categories` and `output_categories`
55
+ with an array of `RocketJob::Category::Input` and `RocketJob::Category::Output`.
56
+
57
+ Jobs that added or modified the input or output categories need to be upgraded. For example:
58
+ ~~~ruby
59
+ class MyJob < RocketJob::Job
60
+ include RocketJob::Batch
61
+
62
+ self.output_categories = [:main, :errors, :ignored]
63
+ end
64
+ ~~~
65
+
66
+ Needs to be changed to:
67
+ ~~~ruby
68
+ class MyJob < RocketJob::Job
69
+ include RocketJob::Batch
70
+
71
+ output_category name: :main
72
+ output_category name: :errors
73
+ output_category name: :ignored
74
+ end
75
+ ~~~
76
+
77
+ ##### slice_size, encrypt, compress
78
+
79
+ These fields have been removed from the job itself:
80
+ ~~~ruby
81
+ class MyJob < RocketJob::Job
82
+ include RocketJob::Batch
83
+
84
+ self.slice_sice = 1_000
85
+ self.encrypt = true
86
+ self.compress = true
87
+ end
88
+ ~~~
89
+
90
+ They are now specified on the `input_category` as follows:
91
+ - `slice_size` just moves under `input_category`.
92
+ - `encrypt` becomes an option to `serializer`.
93
+ - `compress` is now the default for all batch jobs so is not needed.
94
+
95
+ If the serializer is set to `encrypt` then it is automatically compressed.
96
+
97
+ ~~~ruby
98
+ class MyJob < RocketJob::Job
99
+ include RocketJob::Batch
100
+
101
+ input_category slice_sice: 1_000, serializer: :encrypt
102
+ end
103
+ ~~~
104
+
105
+ ##### collect_output, collect_nil_output
106
+
107
+ The following fields have been moved from the job itself:
108
+ ~~~ruby
109
+ class MyJob < RocketJob::Job
110
+ include RocketJob::Batch
111
+
112
+ self.collect_output = true
113
+ self.collect_nil_output = true
114
+ end
115
+ ~~~
116
+
117
+ Into the corresponding `output_category`:
118
+ - `collect_output` no longer has any meaning. Output is collected anytime an `output_category` is defined.
119
+ - `collect_nil_output` is now the option `nils` on the `output_category.
120
+ It defaults to `false` so that by default any `nil` output from the `perform` method is not collected.
121
+ ~~~ruby
122
+ class MyJob < RocketJob::Job
123
+ include RocketJob::Batch
124
+
125
+ output_category nils: true
126
+ end
127
+ ~~~
128
+
129
+ ##### name
130
+
131
+ For both `input_category` and `output_category`, when the `name` argument is not supplied
132
+ it defaults to `:main`.
133
+
134
+ For Example:
135
+ ~~~ruby
136
+ class MyJob < RocketJob::Job
137
+ include RocketJob::Batch
138
+
139
+ input_category name: :main, serializer: :encrypt
140
+ output_category name: :main
141
+ end
142
+ ~~~
143
+
144
+ Is the same as:
145
+ ~~~ruby
146
+ class MyJob < RocketJob::Job
147
+ include RocketJob::Batch
148
+
149
+ input_category serializer: :encrypt
150
+ output_category
151
+ end
152
+ ~~~
153
+
154
+ ##### Existing and inflight jobs
155
+
156
+ When migrating to Rocket Job 6, it is recommended to load every job and then save it back again as part of the
157
+ deployment. When the job loads it will automatically convert itself from the old schema to the new v6 schema.
158
+
159
+ In flight jobs should not be affected, other than it is important to shutdown all running batch
160
+ servers _before_ running any new instances.
31
161
 
32
162
  ## Rocket Job v4
33
163
 
34
- Rocket Job Pro is now open source and included in Rocket Job.
164
+ Rocket Job Pro is now fully open source and included in Rocket Job under the Apache License.
35
165
 
36
166
  The `RocketJob::Batch` plugin now adds batch processing capabilities to break up a single task into many
37
167
  concurrent workers processing slices of the entire job at the same time.
@@ -30,6 +30,5 @@ module RocketJob
30
30
  autoload :ThrottleWindows, "rocket_job/batch/throttle_windows"
31
31
  autoload :Result, "rocket_job/batch/result"
32
32
  autoload :Results, "rocket_job/batch/results"
33
- autoload :Tabular, "rocket_job/batch/tabular"
34
33
  end
35
34
  end
@@ -0,0 +1,39 @@
1
+ # Convert to and from CSV, JSON, xlsx, and PSV files.
2
+ #
3
+ # Example, Convert CSV file to JSON.
4
+ # job = RocketJob::ConversionJob.new
5
+ # job.upload("data.csv")
6
+ # job.output_category.file_name = "data.json"
7
+ # job.save!
8
+ #
9
+ # Example, Convert JSON file to PSV and compress it with GZip.
10
+ # job = RocketJob::ConversionJob.new
11
+ # job.upload("data.json")
12
+ # job.output_category.file_name = "data.psv.gz"
13
+ # job.save!
14
+ #
15
+ # Example, Read a CSV file that has been zipped from a remote website and the convert it to a GZipped json file.
16
+ # job = RocketJob::ConversionJob.new
17
+ # job.upload("https://example.org/file.zip")
18
+ # job.output_category.file_name = "data.json.gz"
19
+ # job.save!
20
+ #
21
+ module RocketJob
22
+ class ConversionJob < RocketJob::Job
23
+ include RocketJob::Batch
24
+
25
+ self.destroy_on_complete = false
26
+
27
+ # Detects file extension for its type
28
+ input_category format: :auto
29
+ output_category format: :auto
30
+
31
+ # When the job completes it will write the result to the output_category.file_name
32
+ after_batch :download
33
+
34
+ def perform(hash)
35
+ # For this job return the input hash record as-is. Could be transformed here as needed.
36
+ hash
37
+ end
38
+ end
39
+ end
@@ -96,12 +96,14 @@ module RocketJob
96
96
  before_batch :run_before_code
97
97
  after_batch :run_after_code
98
98
 
99
- # Make this job collect its output
100
- # :nils [true|false]
101
- # Whether to skip the output from `code` when it is nil
102
- # Default: false
103
- def collect_output(nils: false)
104
- self.output_categories = [RocketJob::Category::Output.new(nils: nils)]
99
+ # Shortcut for setting the slice_size
100
+ def slice_size=(slice_size)
101
+ input_category.slice_size = slice_size
102
+ end
103
+
104
+ # Add a new output category and collect output for it.
105
+ def add_output_category(**args)
106
+ self.output_categories << RocketJob::Category::Output.new(**args)
105
107
  end
106
108
 
107
109
  private
@@ -1,3 +1,3 @@
1
1
  module RocketJob
2
- VERSION = "6.0.0.rc2".freeze
2
+ VERSION = "6.0.0.rc3".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rocketjob
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0.rc2
4
+ version: 6.0.0.rc3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Reid Morrison
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-16 00:00:00.000000000 Z
11
+ date: 2021-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aasm
@@ -160,6 +160,7 @@ files:
160
160
  - lib/rocket_job/job.rb
161
161
  - lib/rocket_job/job_exception.rb
162
162
  - lib/rocket_job/jobs/active_job.rb
163
+ - lib/rocket_job/jobs/conversion_job.rb
163
164
  - lib/rocket_job/jobs/copy_file_job.rb
164
165
  - lib/rocket_job/jobs/dirmon_job.rb
165
166
  - lib/rocket_job/jobs/housekeeping_job.rb