-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🎁 Add graceful fallback of preprocessing #283
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Prior to this commit, if we did not actually have preprocessed file in the remote system, we'd encounter errors with files missing; we assumed we could "copy" the preprocessed url to the local file. With this commit, we check to see if the preprocessed file exists. Then fallback to a specified FileSet#remote_url and the fallback even further. The specs define the expected behavior. Closes #282 Related to: - #282
kirkkwang
reviewed
Nov 6, 2023
|
||
@preprocessed_location_template = | ||
if rodeo_conformant_uri_exists?(derivative_rodeo_candidate) | ||
Rails.logger.debug("#{self.class}##{__method__} found existing file at location #{derivative_rodeo_candidate}. High five partner!") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hah!
kirkkwang
approved these changes
Nov 6, 2023
jeremyf
added a commit
to notch8/derivative_rodeo
that referenced
this pull request
Nov 8, 2023
In working towards gracefully handling a failed copy of a resource in SpaceStone, we conditionally updated the `preprocess_template_location` to be the original HTTP(s) location. The idea being that if it does not exist in the pre-processed location The [DerivativeRodeo::Generators::PdfSplitGenerator](https://github.com/scientist-softserv/derivative_rodeo/blob/84aa08e8387f105488a2b1a1e3821abacff4ad64/lib/derivative_rodeo/generators/pdf_split_generator.rb#L70-L80) method (see below) can gracefully handle returning an empty list of output locations. ```ruby def existing_page_locations(input_location:) # See image_file_basename_template tail_regexp = %r{#{input_location.file_basename}--page-\d+\.#{output_extension}$} output_locations = input_location.derived_file_from(template: output_location_template).matching_locations_in_file_dir(tail_regexp: tail_regexp) return output_locations if output_locations.count.positive? return [] if preprocessed_location_template.blank? input_location.derived_file_from(template: preprocessed_location_template).matching_locations_in_file_dir(tail_regexp: tail_regexp) end ``` At issue is understanding if we need to use the copy task to copy the file locally. We shall see once this is in play. Related to: - notch8/iiif_print#283 - #71
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Prior to this commit, if we did not actually have preprocessed file in
the remote system, we'd encounter errors with files missing; we assumed
we could "copy" the preprocessed url to the local file.
With this commit, we check to see if the preprocessed file exists. Then
fallback to a specified FileSet#remote_url and the fallback even
further.
The specs define the expected behavior.
Closes #282
Related to: