Class: CharacterizeJob
- Inherits:
-
Hyrax::ApplicationJob
- Object
- ApplicationJob
- Hyrax::ApplicationJob
- CharacterizeJob
- Defined in:
- app/jobs/characterize_job.rb
Overview
a ActiveJob
job to process file characterization.
the characterization process is handled by a service object, which is configurable via #characterization_service.
end
Instance Method Summary collapse
-
#perform(file_set, file_id, filepath = nil) ⇒ Object
Characterizes the file at ‘filepath’ if available, otherwise, pulls a copy from the repository and runs characterization on that file.
Instance Method Details
#perform(file_set, file_id, filepath = nil) ⇒ Object
Characterizes the file at ‘filepath’ if available, otherwise, pulls a copy from the repository and runs characterization on that file.
30 31 32 33 34 35 36 37 38 39 40 |
# File 'app/jobs/characterize_job.rb', line 30 def perform(file_set, file_id, filepath = nil) raise "#{file_set.class.characterization_proxy} was not found for FileSet #{file_set.id}" unless file_set.characterization_proxy? # Ensure a fresh copy of the repo file's latest version is being worked on, if no filepath is directly provided filepath = Hyrax::WorkingDirectory.copy_repository_resource_to_working_directory(Hydra::PCDM::File.find(file_id), file_set.id) unless filepath && File.exist?(filepath) characterize(file_set, file_id, filepath) Hyrax.publisher.publish('file.characterized', file_set: file_set, file_id: file_id, path_hint: filepath) end |