Skip to content

Commit

Permalink
Bulkrax should show errors when remote urls are not valid (#1015)
Browse files Browse the repository at this point in the history
* Report errors with files

Bulrax jobs were continuing without reporting an error, with nothing
appearing in the logs due to how the workers & logs interact. This
commit causes file errors to be reported in the importer even though
the job will end normally.

* ⚙️ Fix failing CI

Got the message `Gem::LoadError: pg is not part of
the bundle. Add it to your Gemfile.
(Gem::LoadError)` so this commit will add pg to the Gemfile.

---------

Co-authored-by: LaRita Robinson <[email protected]>
Co-authored-by: Kirk Wang <[email protected]>
  • Loading branch information
3 people authored Feb 7, 2025
1 parent 260dbf5 commit cd23103
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ else
end

gem 'oai'
gem 'pg'
gem 'rsolr', '>= 1.0'
gem 'rspec-rails'
gem 'twitter-typeahead-rails', '0.11.1.pre.corejavascript'
Expand Down
7 changes: 2 additions & 5 deletions app/factories/bulkrax/valkyrie_object_factory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,6 @@ def uploaded_remote_files(remote_files: [])
remote_files.map do |r|
file_path = download_file(r["url"])
next unless file_path

create_uploaded_file(file_path, r["file_name"])
end.compact
end
Expand All @@ -449,8 +448,7 @@ def download_file(url)
file.rewind
file.path
rescue => e
Rails.logger.debug "Failed to download file from #{url}: #{e.message}"
nil
raise "Failed to download file from #{url}: #{e.message}"
end
end

Expand All @@ -460,8 +458,7 @@ def create_uploaded_file(file_path, file_name)
file.close
uploaded_file
rescue => e
Rails.logger.debug "Failed to create Hyrax::UploadedFile for #{file_name}: #{e.message}"
nil
raise "Failed to create Hyrax::UploadedFile for #{file_name}: #{e.message}"
end

# @Override Destroy existing files with Hyrax::Transactions
Expand Down

0 comments on commit cd23103

Please sign in to comment.