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

Add ingestion attempt communication with PMPY #3049

Merged
merged 7 commits into from
Feb 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ New entries in this file should aim to provide a meaningful amount of informatio
### Added
- Push collections and communities to preservation on save along with a rake task to do so [#255](https://github.com/ualbertalib/pushmi_pullyu/issues/255)
- Added minitest-retry gem to retry flapping tests that are able to pass through retries [#3044](https://github.com/ualbertalib/jupiter/pull/3044)
- Add attempt count for entity ingestion on depositable model. Related to [pushmi_pullyu#297](https://github.com/ualbertalib/pushmi_pullyu/issues/297)
pgwillia marked this conversation as resolved.
Show resolved Hide resolved

### Removed
- Skylight performance monitoring. Will need to remove this secret from ansible playbook secrets as well. [#3023](https://github.com/ualbertalib/jupiter/issues/3023)
- Remove brakeman's ruby EOL check [PR#3051](https://github.com/ualbertalib/jupiter/pull/3051)
Expand Down
7 changes: 5 additions & 2 deletions app/models/jupiter_core/depositable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,11 @@ def push_entity_for_preservation

$queue.with do |connection|
# pushmi_pullyu requires both the id and type of the depositable
entity = { uuid: id, type: self.class.table_name }
connection.zadd queue_name, Time.now.to_f, entity.to_json
connection.zadd(queue_name, Time.now.to_f, { uuid: id, type: self.class.table_name }.to_json)
# Add the attempt count as value 0 that pmpy will use to count the tries to ingest the depositable. If the key
# already exists, the value will be reset to 0. the ```connection.zadd``` method called before resets the score as
# well. These two pieces of information let PMPY know that the entity needs to be deposited ASAP
connection.set("#{Rails.application.secrets.attempt_ingest_prefix}#{id}", 0)
end

true
Expand Down
6 changes: 5 additions & 1 deletion config/secrets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ shared:
google_analytics_token: <%= ENV['GOOGLE_ANALYTICS_TOKEN'] %>
allow_crawlers: <%= ENV['RAILS_ALLOW_CRAWLERS'] || false %>
preservation_queue_name: <%= ENV['PMPY_QUEUE_NAME'] || 'prod:pmpy_queue' %>
attempt_ingest_prefix: <%= ENV['ATTEMPT_INGEST_PREFIX'] || "'prod:pmpy_ingest_attempt:'" %>

fits_path: <%= ENV['FITS_PATH'] || 'fits.sh' %>
rack_attack_safelisted_ips: <%= ENV['RACK_ATTACK_SAFELISTED_IPS'] || '""' %>
system_user_api_key: <%= ENV['SYSTEM_USER_API_KEY'] %>
Expand Down Expand Up @@ -62,7 +64,8 @@ development:
fcrepo_password: fedoraAdmin
fcrepo_base_path: /dev

preservation_queue_name: <%= ENV['PMPY_QUEUE_NAME'] || 'dev:pmpy_queue'%>
preservation_queue_name: <%= ENV['PMPY_QUEUE_NAME'] || 'dev:pmpy_queue' %>
attempt_ingest_prefix: <%= ENV['ATTEMPT_INGEST_PREFIX'] || "'dev:pmpy_ingest_attempt:'" %>
system_user_api_key: <%= ENV['SYSTEM_USER_API_KEY'] || '3eeb395e-63b7-11ea-bc55-0242ac130003' %>

test:
Expand All @@ -85,6 +88,7 @@ test:
fcrepo_base_path: /test

preservation_queue_name: <%= ENV['PMPY_QUEUE_NAME'] || 'test:pmpy_queue' %>
attempt_ingest_prefix: <%= ENV['ATTEMPT_INGEST_PREFIX'] || "'test:pmpy_ingest_attempt:'" %>
system_user_api_key: <%= ENV['SYSTEM_USER_API_KEY'] || '3eeb395e-63b7-11ea-bc55-0242ac130003' %>

google_client_id: 'test-google-client-id'
Expand Down