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

Embargo auto expire not working #121

Open
ckarpinski opened this issue Jul 27, 2023 · 14 comments
Open

Embargo auto expire not working #121

ckarpinski opened this issue Jul 27, 2023 · 14 comments
Assignees

Comments

@ckarpinski
Copy link
Collaborator

ckarpinski commented Jul 27, 2023

Created a test work and set an embargo to expire, it never did

@ckarpinski
Copy link
Collaborator Author

RELATED - the PDF in the viewer creates works out of all the pages, if you create a work set to private then later change it to public it does not work because the pages works do not update.

This seems very likely to be true for embargoed work too??

We cant even manually udpate this because of all our required fields - you would have to fill out everything for every page just to be able to save it after changing the visibility. Not realistic for a many page work.

@labradford labradford added the bug Something isn't working label Aug 23, 2023
@labradford labradford self-assigned this Aug 24, 2023
@labradford
Copy link
Contributor

when fixing also contribute fix to hyku up

@labradford
Copy link
Contributor

Need to run these jobs on tenants in production and staging that do not have the jobs in the queue:

rake hyrax:embargo:deactivate_expired
rake hyrax:lease:deactivate_expired

@alishaevn
Copy link
Contributor

the two rake jobs above are found in embargo_lease.rake. (which are essentially the same code that's run in the EmbargoExpiryJob and LeaseExpiryJob.)

the rake tasks are supposed to be run from cron-embargo.yaml and cron-lease.yaml. as a longer term solution, those cron jobs may need to be fixed.

@alishaevn alishaevn self-assigned this Aug 28, 2023
@alishaevn
Copy link
Contributor

before (staging/demo)https://demo.atla-hyku.notch8.cloud/embargoes

Image

I ran rake hyrax:embargo:deactivate_expired and rake hyrax:lease:deactivate_expired in the atla-hyku-staging-hyrax shell and got a 404 error for both.

embargo 404 error
bash-5.1$ rake hyrax:embargo:deactivate_expired
...
rake aborted!
Blacklight::Exceptions::InvalidRequest: RSolr::Error::Http - 404 Not Found
Error: <html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 404 Not Found</title>
</head>
<body><h2>HTTP ERROR 404 Not Found</h2>
<table>
<tr><th>URI:</th><td>/solr/select</td></tr>
<tr><th>STATUS:</th><td>404</td></tr>
<tr><th>MESSAGE:</th><td>Not Found</td></tr>
<tr><th>SERVLET:</th><td>default</td></tr>

URI: http://admin:[email protected]:8983/solr/select?wt=json&&&&fq=embargo_release_date_dtsi%3A%5B*+TO+NOW%5D&&rows=1000&sort=embargo_release_date_dtsi+desc

Backtrace: /usr/local/bundle/gems/rsolr-2.5.0/lib/rsolr/client.rb:220:in `rescue in execute'
/usr/local/bundle/gems/rsolr-2.5.0/lib/rsolr/client.rb:208:in `execute'
/usr/local/bundle/gems/rsolr-2.5.0/lib/rsolr/client.rb:203:in `send_and_receive'
/usr/local/bundle/gems/blacklight-6.24.0/lib/blacklight/solr/repository.rb:61:in `block in send_and_receive'
/usr/local/bundle/gems/activesupport-5.2.8/lib/active_support/benchmarkable.rb:43:in `block in benchmark'
/usr/local/bundle/gems/activesupport-5.2.8/lib/active_support/core_ext/benchmark.rb:14:in `block in ms'
/usr/local/lib/ruby/2.7.0/benchmark.rb:308:in `realtime'
/usr/local/bundle/gems/activesupport-5.2.8/lib/active_support/core_ext/benchmark.rb:14:in `ms'
/usr/local/bundle/gems/activesupport-5.2.8/lib/active_support/benchmarkable.rb:43:in `benchmark'
/usr/local/bundle/gems/blacklight-6.24.0/lib/blacklight/solr/repository.rb:59:in `send_and_receive'
/usr/local/bundle/gems/blacklight-6.24.0/lib/blacklight/solr/repository.rb:22:in `search'
/usr/local/bundle/gems/blacklight-6.24.0/lib/blacklight/solr/repository.rb:72:in `rescue in send_and_receive'
/usr/local/bundle/gems/blacklight-6.24.0/lib/blacklight/solr/repository.rb:58:in `send_and_receive'
/usr/local/bundle/gems/blacklight-6.24.0/lib/blacklight/solr/repository.rb:22:in `search'
/usr/local/bundle/gems/hyrax-3.5.0/app/services/hyrax/restriction_service.rb:16:in `presenters'
/usr/local/bundle/gems/hyrax-3.5.0/app/services/hyrax/embargo_service.rb:12:in `assets_with_expired_embargoes'
/usr/local/bundle/gems/hyrax-3.5.0/lib/tasks/embargo_lease.rake:7:in `block (3 levels) in <top (required)>'
/usr/local/bundle/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'

Caused by:
RSolr::Error::Http: RSolr::Error::Http - 404 Not Found
Error: <html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 404 Not Found</title>
</head>
<body><h2>HTTP ERROR 404 Not Found</h2>
<table>
<tr><th>URI:</th><td>/solr/select</td></tr>
<tr><th>STATUS:</th><td>404</td></tr>
<tr><th>MESSAGE:</th><td>Not Found</td></tr>
<tr><th>SERVLET:</th><td>default</td></tr>

URI: http://admin:[email protected]:8983/solr/select?wt=json&&&&fq=embargo_release_date_dtsi%3A%5B*+TO+NOW%5D&&rows=1000&sort=embargo_release_date_dtsi+desc

Backtrace: /usr/local/bundle/gems/rsolr-2.5.0/lib/rsolr/client.rb:220:in `rescue in execute'
/usr/local/bundle/gems/rsolr-2.5.0/lib/rsolr/client.rb:208:in `execute'
/usr/local/bundle/gems/rsolr-2.5.0/lib/rsolr/client.rb:203:in `send_and_receive'
/usr/local/bundle/gems/blacklight-6.24.0/lib/blacklight/solr/repository.rb:61:in `block in send_and_receive'
/usr/local/bundle/gems/activesupport-5.2.8/lib/active_support/benchmarkable.rb:43:in `block in benchmark'
/usr/local/bundle/gems/activesupport-5.2.8/lib/active_support/core_ext/benchmark.rb:14:in `block in ms'
/usr/local/lib/ruby/2.7.0/benchmark.rb:308:in `realtime'
/usr/local/bundle/gems/activesupport-5.2.8/lib/active_support/core_ext/benchmark.rb:14:in `ms'
/usr/local/bundle/gems/activesupport-5.2.8/lib/active_support/benchmarkable.rb:43:in `benchmark'
/usr/local/bundle/gems/blacklight-6.24.0/lib/blacklight/solr/repository.rb:59:in `send_and_receive'
/usr/local/bundle/gems/blacklight-6.24.0/lib/blacklight/solr/repository.rb:22:in `search'
/usr/local/bundle/gems/rsolr-2.5.0/lib/rsolr/client.rb:220:in `rescue in execute'
/usr/local/bundle/gems/rsolr-2.5.0/lib/rsolr/client.rb:208:in `execute'
/usr/local/bundle/gems/rsolr-2.5.0/lib/rsolr/client.rb:203:in `send_and_receive'
/usr/local/bundle/gems/blacklight-6.24.0/lib/blacklight/solr/repository.rb:61:in `block in send_and_receive'
/usr/local/bundle/gems/activesupport-5.2.8/lib/active_support/benchmarkable.rb:43:in `block in benchmark'
/usr/local/bundle/gems/activesupport-5.2.8/lib/active_support/core_ext/benchmark.rb:14:in `block in ms'
/usr/local/bundle/gems/activesupport-5.2.8/lib/active_support/core_ext/benchmark.rb:14:in `ms'
/usr/local/bundle/gems/activesupport-5.2.8/lib/active_support/benchmarkable.rb:43:in `benchmark'
/usr/local/bundle/gems/blacklight-6.24.0/lib/blacklight/solr/repository.rb:59:in `send_and_receive'
/usr/local/bundle/gems/blacklight-6.24.0/lib/blacklight/solr/repository.rb:22:in `search'
/usr/local/bundle/gems/hyrax-3.5.0/app/services/hyrax/restriction_service.rb:16:in `presenters'
/usr/local/bundle/gems/hyrax-3.5.0/app/services/hyrax/embargo_service.rb:12:in `assets_with_expired_embargoes'
/usr/local/bundle/gems/hyrax-3.5.0/lib/tasks/embargo_lease.rake:7:in `block (3 levels) in <top (required)>'
/usr/local/bundle/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'

Caused by:
Faraday::ResourceNotFound: the server responded with status 404
/usr/local/bundle/gems/faraday-0.17.5/lib/faraday/response/raise_error.rb:8:in `on_complete'
/usr/local/bundle/gems/faraday-0.17.5/lib/faraday/response.rb:9:in `block in call'
/usr/local/bundle/gems/faraday-0.17.5/lib/faraday/response.rb:61:in `on_complete'
/usr/local/bundle/gems/faraday-0.17.5/lib/faraday/response.rb:8:in `call'
/usr/local/bundle/gems/faraday-0.17.5/lib/faraday/rack_builder.rb:143:in `build_response'
/usr/local/bundle/gems/faraday-0.17.5/lib/faraday/connection.rb:387:in `run_request'
/usr/local/bundle/gems/faraday-0.17.5/lib/faraday/connection.rb:138:in `get'
/usr/local/bundle/gems/rsolr-2.5.0/lib/rsolr/client.rb:209:in `execute'
/usr/local/bundle/gems/rsolr-2.5.0/lib/rsolr/client.rb:203:in `send_and_receive'
/usr/local/bundle/gems/blacklight-6.24.0/lib/blacklight/solr/repository.rb:61:in `block in send_and_receive'
/usr/local/bundle/gems/activesupport-5.2.8/lib/active_support/benchmarkable.rb:43:in `block in benchmark'
/usr/local/bundle/gems/activesupport-5.2.8/lib/active_support/core_ext/benchmark.rb:14:in `block in ms'
/usr/local/bundle/gems/activesupport-5.2.8/lib/active_support/core_ext/benchmark.rb:14:in `ms'
/usr/local/bundle/gems/activesupport-5.2.8/lib/active_support/benchmarkable.rb:43:in `benchmark'
/usr/local/bundle/gems/blacklight-6.24.0/lib/blacklight/solr/repository.rb:59:in `send_and_receive'
/usr/local/bundle/gems/blacklight-6.24.0/lib/blacklight/solr/repository.rb:22:in `search'
/usr/local/bundle/gems/hyrax-3.5.0/app/services/hyrax/restriction_service.rb:16:in `presenters'
/usr/local/bundle/gems/hyrax-3.5.0/app/services/hyrax/embargo_service.rb:12:in `assets_with_expired_embargoes'
/usr/local/bundle/gems/hyrax-3.5.0/lib/tasks/embargo_lease.rake:7:in `block (3 levels) in <top (required)>'
/usr/local/bundle/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
Tasks: TOP => hyrax:embargo:deactivate_expired
(See full trace by running task with --trace)
bash-5.1$ 

@alishaevn
Copy link
Contributor

I also don't see a script that's calling the cron-embargo and cron-lease jobs. but even if there was a script, the job is failing. so this appears to be a two part problem.

alishaevn added a commit to samvera/hyrax that referenced this issue Aug 28, 2023
with this commit, a user is able to run `rake hyrax:embargo:deactivate_expired` or `rake hyrax:lease:deactivate_expired` manually and only release the embargoes or leases whose expiration/release dates have already passed.
we are not simply calling the `deactivate!` method in each manager because that would deactivate ALL leases and embargoes, even if they are still active.

ref: #2657
ref: scientist-softserv/atla-hyku#121
@alishaevn
Copy link
Contributor

related pr: samvera/hyrax#6235

@alishaevn
Copy link
Contributor

tamsin and I were in conversation about the above pr last week. samvera/hyrax#6241 was also created as tamsin thought it was the actual issue. it has bee merged to main.

will need to see if the above issue still exists on main or if some portion of samvera/hyrax#6235 is still needed.

@alishaevn
Copy link
Contributor

samvera/hyrax#6241 has been merged to main. I'll test to see if the reported issue still exists.

@alishaevn
Copy link
Contributor

Image

@alishaevn
Copy link
Contributor

the embargoes I created last week are still present. ref: samvera/hyrax#6235 (comment)

@alishaevn
Copy link
Contributor

in reading my initial comment on samvera/hyrax#6235 again, I remembered that the embargoes that are set to expire don't automatically expire. (as is the expectation. there's a ticket to change that here, but it's been open for 5.5 years)

to actually expire an embargo, there's a rake task (rails hyrax:embargo:deactivate_expired), cron job, and EmbargoExpiryJob (which is nearly the same as the rake task). I used the rake task on hyrax main today and it properly expired the embargoed works! 🎉

now that work will need to be brought into atla hyku.

alishaevn added a commit that referenced this issue Sep 26, 2023
This code is copied from samvera/hyrax#6241
to solve #121. In
that PR, the ability to expire embargoes using a rake task works.

The copied code has not been included in a release yet. At the time of
this writing, September 26, 2023, it is in hyrax main. The latest
release is `hyrax-v4.0.0`.

This app is currently using hyrax-v3.5.0. However, since the changes
being brought in are coming from hyrax main, I'm including the entire
files instead of writing decorators.
@alishaevn
Copy link
Contributor

@rj568
Copy link

rj568 commented Aug 29, 2024

Hello, just commenting as another user who would expect that an expired embargo would release without the need of manual deactivation. What is happening with this? Is this only being rolled out in the latest versions of Hyrax/Hyku?We're on Hyku 5 ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Development
Development

No branches or pull requests

5 participants