base_indexer 3.0.0.pre1 → 3.0.0

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
  SHA1:
3
- metadata.gz: bf0470bb5a1c835a86d069127d8e02cb7504454b
4
- data.tar.gz: abcb0fe938d4f8a3aa84df83950ddf4ba6d7902b
3
+ metadata.gz: 7c8632ff625459ac2ee0a4b34e95e2fa38ed4306
4
+ data.tar.gz: b3eaab7a1ef88ee04ae3cfa8429e66075af7ce5a
5
5
  SHA512:
6
- metadata.gz: 5554938e73ffe3d17f3b079cd2248f936c02ed0aeb2509db50563047e835ae06d5b5d54d0d711d32d4efeed5b277234a4557e525046f595f22e77b91d6311cd3
7
- data.tar.gz: 8ba932273e7dafad5b3f6718a9385bb2848a7196da3578649df5605cd23fbd8c385921b4e8c82a70d35f20fad8a25b589b6404734043d57592b68096de38174c
6
+ metadata.gz: fbfabfa97ae959e72e1638d4d2c0abeedac7efda67d625c82537ab6ef10805270c20cd5bf79d74b87e6b9072c7562f91c85e23b98803e4b377e568545224bddc
7
+ data.tar.gz: 0e266c03b6556806684761f5f7c32bb85f7e95ea586748771533fa0d8defd7760e71fca8e7f4062ef83e1938d0a334f03f9c30c4caf475f1b9b63ccf2bba76fc
@@ -34,7 +34,7 @@ module BaseIndexer
34
34
  rescue Exception => e
35
35
  @status = report_failure request.method_symbol, params, e
36
36
  Rails.logger.error @status
37
- render nothing: true, status: 202
37
+ render nothing: true, status: 500
38
38
  end
39
39
  end
40
40
  end
@@ -11,7 +11,7 @@ module BaseIndexer
11
11
  Rails.logger.debug "Completing indexing #{druid}"
12
12
  rescue StandardError => e
13
13
  Rails.logger.error report_failure request.method_symbol, params, e
14
- render nothing: true, status: 202
14
+ render nothing: true, status: 500
15
15
  end
16
16
 
17
17
  def destroy
@@ -29,7 +29,7 @@ module BaseIndexer
29
29
  Rails.logger.debug "Completing deleting #{druid}"
30
30
  rescue StandardError => e
31
31
  Rails.logger.error report_failure request.method_symbol, params, e
32
- render nothing: true, status: 202
32
+ render nothing: true, status: 500
33
33
  end
34
34
 
35
35
  private
@@ -19,7 +19,7 @@ module BaseIndexer
19
19
  #
20
20
  # {"target1":{"url"=>"http://localhost/solr/","open_timeout"=>120},"target2":{"url"=>"http://solr-cor.com/solr/"}}
21
21
  def get_configuration_hash
22
- @solr_config_hash
22
+ Hash[ @solr_config_hash.collect {|k,v| [k.upcase, v] } ] # updase all of the target names
23
23
  end
24
24
  end
25
25
  end
@@ -35,7 +35,7 @@ module BaseIndexer
35
35
  # @param max_retries [Integer] the maximum number of tries before fail
36
36
  def self.process(id, solr_doc, solr_connector, max_retries, is_delete = false)
37
37
  handler = proc do |exception, attempt_number, _total_delay|
38
- DiscoveryIndexer::Logging.logger.debug "#{exception.class} on attempt #{attempt_number} for #{id}"
38
+ DiscoveryIndexer::Logging.logger.error "#{exception.class} on attempt #{attempt_number} for #{id}"
39
39
  end
40
40
 
41
41
  with_retries(max_tries: max_retries, handler: handler, base_sleep_seconds: 1, max_sleep_seconds: 5) do |attempt|
@@ -43,9 +43,11 @@ module BaseIndexer
43
43
 
44
44
  def get_connector_for_target(solr_target)
45
45
  solr_connector = nil
46
- if solr_targets_configs.keys.include?(solr_target)
47
- config = solr_targets_configs[solr_target]
48
- solr_connector = RSolr.connect(config.deep_symbolize_keys)
46
+ unless solr_targets_configs.nil?
47
+ if solr_targets_configs.keys.include?(solr_target)
48
+ config = solr_targets_configs[solr_target]
49
+ solr_connector = RSolr.connect(config.deep_symbolize_keys)
50
+ end
49
51
  end
50
52
  solr_connector
51
53
  end
@@ -1,3 +1,3 @@
1
1
  module BaseIndexer
2
- VERSION = '3.0.0.pre1'
2
+ VERSION = '3.0.0'
3
3
  end
data/lib/tasks/index.rake CHANGED
@@ -30,7 +30,7 @@ task :log_indexer => :environment do |t, args|
30
30
  raise 'Log type must be preassembly, remediate or csv.' unless ['preassembly','remediate','csv'].include? log_type
31
31
  raise 'Log file not found.' unless File.readable? log_file_path
32
32
 
33
- target_config=BaseIndexer.solr_configuration_class_name.constantize.instance.get_configuration_hash[target]
33
+ target_config=BaseIndexer.solr_configuration_class_name.constantize.instance.get_configuration_hash[target.upcase]
34
34
 
35
35
  raise 'Target not found.' if target_config.nil?
36
36
 
@@ -55,7 +55,7 @@ task :log_indexer => :environment do |t, args|
55
55
  druids=csv.map { |row| row.to_hash.with_indifferent_access['druid'] }.delete_if {|druid| druid.nil?}
56
56
  end
57
57
 
58
- solr_server=BaseIndexer.solr_configuration_class_name.constantize.instance.get_configuration_hash[target]['url']
58
+ solr_server=target_config['url']
59
59
 
60
60
  log my_logger,"** Indexing #{druids.size} druids from #{log_file_path} into solr server #{solr_server} (target=#{target}). Log file is of type #{log_type}."
61
61
  log my_logger,"Indexing started at #{start_time}"
@@ -121,11 +121,11 @@ task :index => :environment do |t, args|
121
121
 
122
122
  raise 'You must specify a target and druid.' if target.blank? || druid.blank?
123
123
 
124
- target_config=BaseIndexer.solr_configuration_class_name.constantize.instance.get_configuration_hash[target]
124
+ target_config=BaseIndexer.solr_configuration_class_name.constantize.instance.get_configuration_hash[target.upcase]
125
125
 
126
126
  raise 'Target not found.' if target_config.nil?
127
127
 
128
- solr_server=BaseIndexer.solr_configuration_class_name.constantize.instance.get_configuration_hash[target]['url']
128
+ solr_server=target_config['url']
129
129
 
130
130
  puts "** Indexing #{druid} druid into solr server #{solr_server} (target=#{target})."
131
131
 
@@ -144,11 +144,11 @@ task :collection_indexer => :environment do |t, args|
144
144
 
145
145
  raise 'You must specify a target and collection druid.' if target.blank? || collection_druid.blank?
146
146
 
147
- target_config=BaseIndexer.solr_configuration_class_name.constantize.instance.get_configuration_hash[target]
147
+ target_config=BaseIndexer.solr_configuration_class_name.constantize.instance.get_configuration_hash[target.upcase]
148
148
 
149
149
  raise 'Target not found.' if target_config.nil?
150
150
 
151
- solr_server=BaseIndexer.solr_configuration_class_name.constantize.instance.get_configuration_hash[target]['url']
151
+ solr_server=target_config['url']
152
152
 
153
153
  output_log_file_name="#{Rails.root}/log/collection_#{collection_druid}_indexer_#{Time.now.strftime('%Y%m%d-%H%M%S')}.log"
154
154
  my_logger=Logger.new(output_log_file_name) # set up a new log file
@@ -211,7 +211,7 @@ task :reindexer => :environment do |t, args|
211
211
  raise 'You must specify a target and file.' if target.blank? || file_path.blank?
212
212
  raise 'File not found.' unless File.readable? file_path
213
213
 
214
- target_config=BaseIndexer.solr_configuration_class_name.constantize.instance.get_configuration_hash[target]
214
+ target_config=BaseIndexer.solr_configuration_class_name.constantize.instance.get_configuration_hash[target.upcase]
215
215
 
216
216
  raise 'Target not found.' if target_config.nil?
217
217
 
@@ -220,7 +220,7 @@ task :reindexer => :environment do |t, args|
220
220
  errors=0
221
221
  indexed=0
222
222
 
223
- solr_server=BaseIndexer.solr_configuration_class_name.constantize.instance.get_configuration_hash[target]['url']
223
+ solr_server=target_config['url']
224
224
 
225
225
  output_log_file_name="#{Rails.root}/log/#{File.basename(file_path,File.extname(file_path))}_reindex_#{Time.now.strftime('%Y%m%d-%H%M%S')}.log"
226
226
  my_logger=Logger.new(output_log_file_name) # set up a new log file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: base_indexer
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.pre1
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ahmed Alsum
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-08-20 00:00:00.000000000 Z
12
+ date: 2016-09-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -29,16 +29,22 @@ dependencies:
29
29
  name: discovery-indexer
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - "~>"
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: 2.0.0
34
+ version: '2'
35
+ - - "<="
36
+ - !ruby/object:Gem::Version
37
+ version: '4.0'
35
38
  type: :runtime
36
39
  prerelease: false
37
40
  version_requirements: !ruby/object:Gem::Requirement
38
41
  requirements:
39
- - - "~>"
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: '2'
45
+ - - "<="
40
46
  - !ruby/object:Gem::Version
41
- version: 2.0.0
47
+ version: '4.0'
42
48
  - !ruby/object:Gem::Dependency
43
49
  name: retries
44
50
  requirement: !ruby/object:Gem::Requirement
@@ -54,7 +60,7 @@ dependencies:
54
60
  - !ruby/object:Gem::Version
55
61
  version: '0'
56
62
  - !ruby/object:Gem::Dependency
57
- name: is_it_working-cbeer
63
+ name: dor-fetcher
58
64
  requirement: !ruby/object:Gem::Requirement
59
65
  requirements:
60
66
  - - ">="
@@ -225,7 +231,6 @@ files:
225
231
  - app/views/base_indexer/items/destroy.json.erb
226
232
  - app/views/base_indexer/items/new.json.erb
227
233
  - config/initializers/base_indexer.rb
228
- - config/initializers/is_it_working.rb
229
234
  - config/routes.rb
230
235
  - lib/base_indexer.rb
231
236
  - lib/base_indexer/config/solr_configuration.rb
@@ -254,9 +259,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
254
259
  version: '0'
255
260
  required_rubygems_version: !ruby/object:Gem::Requirement
256
261
  requirements:
257
- - - ">"
262
+ - - ">="
258
263
  - !ruby/object:Gem::Version
259
- version: 1.3.1
264
+ version: '0'
260
265
  requirements: []
261
266
  rubyforge_project:
262
267
  rubygems_version: 2.5.1
@@ -1,3 +0,0 @@
1
- require 'is_it_working'
2
- Rails.configuration.middleware.use(IsItWorking::Handler) do |_h|
3
- end