From f7b9053188c887b45e246ea34c5783f41954cad9 Mon Sep 17 00:00:00 2001 From: Mark Bussey Date: Wed, 15 Dec 2021 13:48:49 -0600 Subject: [PATCH] Fix SerializationError in Regenerate Derivatives job CreateDerivativesJob expects a FileID of type String instead of a Hydra::PCDM::File object. see https://github.com/samvera/hyrax/blob/main/app/jobs/create_derivatives_job.rb#L6 Running the task as-is gives me the following error: ``` RAILS_ENV=production bundle exec rails hyrax:file_sets:regenerate_derivatives [DEPRECATION] PCDM is deprecating 'Class#PreservationMasterFile'. Use Class#PreservationFile instead. rails aborted! ActiveJob::SerializationError: Unsupported argument type: Hydra::PCDM::File ``` This was the simplest change I could make to get the task to run successfully. --- lib/tasks/regenerate_derivatives.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/regenerate_derivatives.rake b/lib/tasks/regenerate_derivatives.rake index 43a72d0ff0..a59f2671a0 100644 --- a/lib/tasks/regenerate_derivatives.rake +++ b/lib/tasks/regenerate_derivatives.rake @@ -5,7 +5,7 @@ namespace :hyrax do desc 'Regenerate derivatives for all FileSets in the repository' task regenerate_derivatives: :environment do FileSet.all.each do |fs| - fs.files.each { |fi| CreateDerivativesJob.perform_later(fs, fi) } + fs.files.each { |fi| CreateDerivativesJob.perform_later(fs, fi.id) } end end end