rocketjob 5.3.2 → 5.3.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9fc6fef03f96de2e2645a4419a4f4f0cdf409da64a7bb708bcddb24ae0fc6c4f
4
- data.tar.gz: 4c8573924fae294676afc2114a83b522c64a3b259e679a2a343fc4b34f7bab8f
3
+ metadata.gz: d487b34621338794b4e3da43753d858bf174b45f4f0dff6c9f478e212a71db8e
4
+ data.tar.gz: b6c3ddf2688a54dee0ad6ae6d1c4e4fc38448674dcbb7e0052d0295e57258f2d
5
5
  SHA512:
6
- metadata.gz: e21ca8c550d28e77d48a6b47b3f7e0c822350e72ba557e56749277f8a2536cd669f63b86b20c39bc264b8619196f40a2aa38940cb04aedaad1a1a07daa36b666
7
- data.tar.gz: cd3202dd8ecf093ba591385aab9529f8f8f2d1bf7f286252db9ab7589f49c86293d96f3e72bd5ba85eed6b344eb92f35414cc3c32ee327dcf00f722b4929d2a4
6
+ metadata.gz: 83e61b6520e71e370b2519ee8f937bdf69060050e67ca4ec3146e6a9306a6c26fd0307cb54c94189c2149eb3f8e14fbe7aa8f3fc6f9c17d6b06804745ecaf570
7
+ data.tar.gz: 20d83702151f6a1333152aa7ee903e7f7c4a79593291496f80670b7952c170734edec16280f0f449db01483e77e7e3af48c8100905688a5bd8998da573f74160
@@ -12,6 +12,7 @@ module RocketJob
12
12
  included do
13
13
  field :tabular_input_header, type: Array, class_attribute: true, user_editable: true
14
14
  field :tabular_input_format, type: Symbol, default: :csv, class_attribute: true, user_editable: true
15
+ field :tabular_input_options, type: Hash, class_attribute: true
15
16
 
16
17
  # tabular_input_mode: [:line | :array | :hash]
17
18
  # :line
@@ -53,7 +54,9 @@ module RocketJob
53
54
  input_stream = stream.nil? ? nil : IOStreams.new(stream)
54
55
 
55
56
  if stream && (tabular_input_type == :text)
56
- input_stream.option_or_stream(:encode, encoding: "UTF-8", cleaner: :printable, replace: "")
57
+ # Cannot change the length of fixed width lines
58
+ replace = tabular_input_format == :fixed ? " " : ""
59
+ input_stream.option_or_stream(:encode, encoding: "UTF-8", cleaner: :printable, replace: replace)
57
60
  end
58
61
 
59
62
  # If an input header is not required, then we don't extract it'
@@ -96,14 +99,15 @@ module RocketJob
96
99
  allowed_columns: tabular_input_white_list,
97
100
  required_columns: tabular_input_required,
98
101
  skip_unknown: tabular_input_skip_unknown,
99
- format: tabular_input_format
102
+ format: tabular_input_format,
103
+ format_options: tabular_input_options&.deep_symbolize_keys
100
104
  )
101
105
  end
102
106
 
103
107
  def tabular_input_render
104
- unless tabular_input_header.blank? && tabular_input.header?
105
- @rocket_job_input = tabular_input.record_parse(@rocket_job_input)
106
- end
108
+ return if tabular_input_header.blank? && tabular_input.header?
109
+
110
+ @rocket_job_input = tabular_input.record_parse(@rocket_job_input)
107
111
  end
108
112
 
109
113
  # Cleanse custom input header if supplied.
@@ -12,6 +12,7 @@ module RocketJob
12
12
  included do
13
13
  field :tabular_output_header, type: Array, class_attribute: true, user_editable: true, copy_on_restart: true
14
14
  field :tabular_output_format, type: Symbol, default: :csv, class_attribute: true, user_editable: true, copy_on_restart: true
15
+ field :tabular_output_options, type: Hash, class_attribute: true
15
16
 
16
17
  validates_inclusion_of :tabular_output_format, in: IOStreams::Tabular.registered_formats
17
18
 
@@ -31,8 +32,9 @@ module RocketJob
31
32
 
32
33
  # Overrides: `RocketJob::Batch::IO#download` to add the `tabular_output_header`.
33
34
  def download(file_name_or_io = nil, category: :main, **args, &block)
34
- # No header required
35
- return super(file_name_or_io, category: category, **args, &block) unless tabular_output.requires_header?(category)
35
+ unless tabular_output.requires_header?(category)
36
+ return super(file_name_or_io, category: category, **args, &block)
37
+ end
36
38
 
37
39
  header = tabular_output.render_header(category)
38
40
  super(file_name_or_io, header_line: header, category: category, **args, &block)
@@ -43,7 +45,11 @@ module RocketJob
43
45
  # Delimited instance used for this slice, by a single worker (thread)
44
46
  def tabular_output
45
47
  @tabular_output ||= Tabular.new(
46
- main: IOStreams::Tabular.new(columns: tabular_output_header, format: tabular_output_format)
48
+ main: IOStreams::Tabular.new(
49
+ columns: tabular_output_header,
50
+ format: tabular_output_format,
51
+ format_options: tabular_output_options&.deep_symbolize_keys
52
+ )
47
53
  )
48
54
  end
49
55
 
@@ -46,7 +46,7 @@ module RocketJob
46
46
  next if slice.failed?
47
47
 
48
48
  slice.fail_on_exception!(re_raise_exceptions) { rocket_job_process_slice(slice) }
49
- elsif record_count && rocket_job_batch_complete?(worker.name)
49
+ elsif record_count && fail_on_exception!(re_raise_exceptions) { rocket_job_batch_complete?(worker.name) }
50
50
  return false
51
51
  else
52
52
  logger.debug "No more work available for this job"
@@ -0,0 +1,12 @@
1
+ require "mongoid/fields/validators/macro"
2
+ require "semantic_logger"
3
+ module RocketJob
4
+ module RemoveMongoidWarnings
5
+ # Remove annoying warnings about Symbols type being deprecated.
6
+ def validate_options(*params)
7
+ SemanticLogger.silence(:error) { super(*params) }
8
+ end
9
+ end
10
+ end
11
+
12
+ ::Mongoid::Fields::Validators::Macro.extend(RocketJob::RemoveMongoidWarnings)
@@ -25,7 +25,7 @@ module RocketJob
25
25
 
26
26
  self.destroy_on_complete = false
27
27
  # Number of times to automatically retry the copy. Set to `0` for no retry attempts.
28
- self.retry_limit = 5
28
+ self.retry_limit = 10
29
29
 
30
30
  # File names in IOStreams URL format.
31
31
  field :source_url, type: String, user_editable: true
@@ -1,8 +1,5 @@
1
- begin
2
- require "active_record"
3
- rescue LoadError
4
- raise 'RocketJob::Jobs::ReEncrypt::RelationalJob uses ActiveRecord to obtain the database connection, please install the gem "activerecord".'
5
- end
1
+ require "active_record"
2
+ require "sync_attr"
6
3
 
7
4
  # Batch Worker to Re-encrypt all encrypted fields in MySQL that start with `encrytped_`.
8
5
  #
@@ -73,12 +73,13 @@ module RocketJob
73
73
  if failed? || !may_fail?
74
74
  self.exception = JobException.from_exception(e)
75
75
  exception.worker_name = worker_name
76
- save! unless new_record? || destroyed?
77
- elsif new_record? || destroyed?
78
- fail(worker_name, e)
79
76
  else
80
- fail!(worker_name, e)
77
+ fail(worker_name, e)
81
78
  end
79
+
80
+ # Prevent validation failures from failing the job
81
+ save(validate: false) unless new_record? || destroyed?
82
+
82
83
  raise e if re_raise_exceptions
83
84
  end
84
85
  end
@@ -1,3 +1,3 @@
1
1
  module RocketJob
2
- VERSION = "5.3.2".freeze
2
+ VERSION = "5.3.3".freeze
3
3
  end
@@ -13,6 +13,9 @@ require "rocket_job/extensions/mongoid/clients/options"
13
13
  require "rocket_job/extensions/mongoid/contextual/mongo"
14
14
  require "rocket_job/extensions/mongoid/factory"
15
15
 
16
+ # Apply patches for deprecated Symbol type
17
+ require "rocket_job/extensions/mongoid/remove_warnings"
18
+
16
19
  # @formatter:off
17
20
  module RocketJob
18
21
  autoload :ActiveWorker, "rocket_job/active_worker"
@@ -71,7 +74,9 @@ module RocketJob
71
74
  autoload :SimpleJob, "rocket_job/jobs/simple_job"
72
75
  autoload :UploadFileJob, "rocket_job/jobs/upload_file_job"
73
76
  module ReEncrypt
74
- autoload :RelationalJob, "rocket_job/jobs/re_encrypt/relational_job"
77
+ if defined?(ActiveRecord) && defined?(SyncAttr)
78
+ autoload :RelationalJob, "rocket_job/jobs/re_encrypt/relational_job"
79
+ end
75
80
  end
76
81
  end
77
82
 
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: 5.3.2
4
+ version: 5.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Reid Morrison
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-18 00:00:00.000000000 Z
11
+ date: 2020-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aasm
@@ -148,6 +148,7 @@ files:
148
148
  - lib/rocket_job/extensions/mongoid/clients/options.rb
149
149
  - lib/rocket_job/extensions/mongoid/contextual/mongo.rb
150
150
  - lib/rocket_job/extensions/mongoid/factory.rb
151
+ - lib/rocket_job/extensions/mongoid/remove_warnings.rb
151
152
  - lib/rocket_job/extensions/rocket_job_adapter.rb
152
153
  - lib/rocket_job/heartbeat.rb
153
154
  - lib/rocket_job/job.rb
@@ -224,7 +225,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
224
225
  - !ruby/object:Gem::Version
225
226
  version: '0'
226
227
  requirements: []
227
- rubygems_version: 3.1.2
228
+ rubygems_version: 3.0.8
228
229
  signing_key:
229
230
  specification_version: 4
230
231
  summary: Ruby's missing batch processing system.