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 |
# 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? filepath = Hyrax::WorkingDirectory.find_or_retrieve(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 |