From 96cc0d9fcd80c4bdc4bd122ccca5a3ce2dbe47c8 Mon Sep 17 00:00:00 2001 From: Nick Budak Date: Thu, 29 Feb 2024 15:36:39 -0800 Subject: [PATCH 1/2] Update to GeoCombine v0.9 --- Gemfile | 1 + Gemfile.lock | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 76f4cf5a..19f50d67 100644 --- a/Gemfile +++ b/Gemfile @@ -78,6 +78,7 @@ gem 'twitter-typeahead-rails' gem 'blacklight_range_limit', '~> 7.0' gem 'redis', '~> 5.0' gem 'geo_monitor', '~> 0.7', github: 'geoblacklight/geo_monitor' +gem 'geo_combine', '>= 0.9' # For OpenGeoMetadata indexing gem 'sidekiq', '~> 7.0' gem 'whenever', require: false gem 'bootstrap', '~> 4.0' diff --git a/Gemfile.lock b/Gemfile.lock index e452e981..34fb1ab4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -227,13 +227,16 @@ GEM faraday-net_http_persistent (2.1.0) faraday (~> 2.5) net-http-persistent (~> 4.0) + faraday-retry (2.2.0) + faraday (~> 2.0) ffi (1.16.3) ffi-compiler (1.0.1) ffi (>= 1.0.0) rake - geo_combine (0.8.0) + geo_combine (0.9.0) activesupport faraday-net_http_persistent (~> 2.0) + faraday-retry (~> 2.2) git json-schema nokogiri @@ -573,6 +576,7 @@ DEPENDENCIES dlss-capistrano factory_bot_rails (~> 6.2.0) faraday (~> 2.0) + geo_combine (>= 0.9) geo_monitor (~> 0.7)! geoblacklight (~> 3.8) honeybadger From 00032fd42cbd01c466d4a42bbd1306ad14f21e82 Mon Sep 17 00:00:00 2001 From: Nick Budak Date: Tue, 13 Feb 2024 15:37:34 -0800 Subject: [PATCH 2/2] Add scheduled tasks to pull and index OpenGeoMetadata records --- config/schedule.rb | 5 +++++ lib/tasks/earthworks.rake | 21 +++------------------ 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/config/schedule.rb b/config/schedule.rb index cfc94021..34f2f41c 100644 --- a/config/schedule.rb +++ b/config/schedule.rb @@ -44,3 +44,8 @@ every 1.day, at: '4:04 am', roles: %i[whenevs] do rake 'rake earthworks:prune_old_search_data[14]' end + +every :tuesday, at: '5:04 am', roles: %i[whenevs] do + rake 'rake earthworks:opengeometadata:pull' + rake 'rake earthworks:opengeometadata:index' +end diff --git a/lib/tasks/earthworks.rake b/lib/tasks/earthworks.rake index 0f0a0407..3d920a8b 100644 --- a/lib/tasks/earthworks.rake +++ b/lib/tasks/earthworks.rake @@ -114,35 +114,20 @@ namespace :earthworks do desc 'Initialize OpenGeoMetadata repositories' task :clone do harvester = Earthworks::Harvester.new(ogm_repos: Settings.OGM_REPOS) - total = harvester.clone_all - puts "Cloned #{total} repositories" + harvester.clone_all end desc 'Fetch updated OpenGeoMetadata records for indexing' task :pull do harvester = Earthworks::Harvester.new(ogm_repos: Settings.OGM_REPOS) - total = harvester.pull_all - puts "Updated #{total} repositories" + harvester.pull_all end desc 'Index OpenGeoMetadata repositories' task :index do harvester = Earthworks::Harvester.new(ogm_repos: Settings.OGM_REPOS) indexer = GeoCombine::Indexer.new - puts "Indexing #{harvester.ogm_path} into #{indexer.solr_url}" - total = indexer.index(harvester.docs_to_index) - puts "Indexed #{total} documents" - end - - desc 'Index content from GeoBlacklight sites' - task :harvest_geo_blacklight do - GeoCombine::GeoBlacklightHarvester.configure do - Settings.GEO_BLACKLIGHT_HARVEST_SITES.to_h - end - - Settings.GEO_BLACKLIGHT_HARVEST_SITES.to_h.keys.each do |site_key| - Rake::Task['geocombine:geoblacklight_harvester:index'].invoke(site_key) - end + indexer.index(harvester.docs_to_index) end end