Skip to content
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

Valkyrie publish file.characterized event for derivative creation #6180

Merged
merged 4 commits into from
Aug 28, 2023

Conversation

lsitu
Copy link
Contributor

@lsitu lsitu commented Aug 23, 2023

Fixes

Fixes #6162 ; refs #6162

Summary

Valkyrie publish file.characterized event for derivative creation.

@samvera/hyrax-code-reviewers

@lsitu lsitu changed the title WIP: Valkyrie publish file.characterized event for derivative creation Valkyrie publish file.characterized event for derivative creation Aug 23, 2023
CreateDerivativesJob
.perform_later(file_set, event[:file_id], event[:path_hint])
else
# With valkyrie, file.characterized event is also published for derivatives.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we don't want this to be true!

the valkyrie code path shouldn't be calling characterization on files that don't require characterization, right? i think this filter should go below around https://github.com/samvera/hyrax/pull/6180/files#diff-c1500de3cd457700a4445ea1b341164b5a822aa64a086d85e12eb9adfdfeba79R54, or else in the ValkyrieCharacterizationService?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@no-reply Okay, I just moved the filter down to line https://github.com/samvera/hyrax/pull/6180/files#diff-c1500de3cd457700a4445ea1b341164b5a822aa64a086d85e12eb9adfdfeba79R54 as suggested. This will prevent it from running the file characterization job for derivative.s. But in UCSD dams, currently we have file characterization for all files, including derivatives.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But in UCSD dams, currently we have file characterization for all files, including derivatives.

that seems okay. if downstream applications want to characterize under different conditions, it's easy to subscribe a new listener with the desired behavior.

@no-reply no-reply added the notes-valkyrie Release Notes: Valkyrie specific label Aug 24, 2023
@lsitu lsitu force-pushed the valkyrie-publish-file-characterized branch 2 times, most recently from 51582a4 to c42d0f8 Compare August 28, 2023 16:06
@@ -39,7 +47,9 @@ def on_file_metadata_updated(event)
# @param [Dry::Events::Event] event
# @return [void]
def on_file_uploaded(event)
# Run characterization
# Run characterization for original file only
return unless event[:metadata].original_file?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return unless event[:metadata].original_file?
return unless event[:metadata]&.original_file?

:metadata probably SHOULD always be provided, but unhandled exceptions in listeners are very disruptive, so it's nice not to allow for nil errors.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! Yep, that's what I thought. And the origin code event[:metadata].file in https://github.com/samvera/hyrax/pull/6180/files#diff-c1500de3cd457700a4445ea1b341164b5a822aa64a086d85e12eb9adfdfeba79L45 hinted me to remove that & sign 😄 .

no-reply
no-reply previously approved these changes Aug 28, 2023
Copy link
Contributor

@no-reply no-reply left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, minus the minor suggestion, which i won't block on.

@no-reply no-reply force-pushed the valkyrie-publish-file-characterized branch from c42d0f8 to 82a1166 Compare August 28, 2023 17:00
Copy link
Contributor

@dunn dunn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested successfully locally

@no-reply no-reply merged commit 3e2dd81 into main Aug 28, 2023
3 checks passed
@no-reply no-reply deleted the valkyrie-publish-file-characterized branch August 28, 2023 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
notes-valkyrie Release Notes: Valkyrie specific
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ValkyrieCharacterizationService should publish file.characterized
3 participants