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

Adds publish robot. #5198

Merged
merged 1 commit into from
Oct 31, 2024
Merged

Adds publish robot. #5198

merged 1 commit into from
Oct 31, 2024

Conversation

justinlittman
Copy link
Contributor

refs #5197

Why was this change made? 🤔

Simplification. See ticket.

How was this change tested? 🤨

Unit, QA.

⚡ ⚠ If this change has cross service impact, including data writes to shared file systems, run integration tests and/or test in [stage|qa] environment, in addition to specs. ⚡

@@ -21,6 +22,10 @@ gem 'purl_fetcher-client', '~> 2.1'
gem 'stanford-mods' # for indexing
gem 'sul_orcid_client', '~> 0.3'

source 'https://gems.contribsys.com/' do
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Robots use Sidekiq Pro.

@@ -107,7 +107,7 @@ def accession
def publish
result = BackgroundJobResult.create
EventFactory.create(druid: params[:id], event_type: 'publish_request_received', data: { background_job_result_id: result.id })
PublishJob.set(queue: publish_queue).perform_later(druid: params[:id], background_job_result: result, workflow: params[:workflow])
PublishJob.set(queue: publish_queue).perform_later(druid: params[:id], background_job_result: result)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can't get rid of this endpoint since it is invoked by DSA; however, it no longer needs to be concerned with workflows.

workflow:,
workflow_process: workflow_process_for(workflow),
output: { errors: [{ title: 'Publishing error', detail: 'Cannot publish an admin policy' }] })
background_job_result.output = { errors: [{ title: 'Publishing error', detail: 'Cannot publish an admin policy' }] }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since this is no longer updating workflows, LogFailureJob / LogSuccessJob are no longer necessary.

end

Publish::MetadataTransferService.publish(druid:, user_version:, workflow:)
Publish::MetadataTransferService.publish(druid:, user_version:)
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 need to pass on workflow to MetadataTransferService.

@@ -0,0 +1,21 @@
# frozen_string_literal: true

module Robots
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well isn't this robot simple.

@@ -0,0 +1,18 @@
# frozen_string_literal: true

module Robots
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Override some methods from LyberCore::Robot since this is running in DSA.

# @param [String] workflow (optional) the workflow used for reporting back status to (defaults to 'accessionWF')
def self.publish(druid:, user_version: nil, workflow: 'accessionWF')
new(druid:, workflow:, user_version:).publish
def self.publish(druid:, user_version: nil)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

MetadataTransferService no longer needs to know about workflows.

# Add the following to a sidekiq.yml to have it handle robot jobs.
# :labels:
# - robot
if config[:labels].include?('robot')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This configures Sidekiq server differently whether running robots or normal DSA jobs.

@@ -128,15 +128,6 @@ paths:
required: true
schema:
$ref: "#/components/schemas/Druid"
- name: workflow
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 longer needed in API.

@justinlittman justinlittman force-pushed the robot branch 8 times, most recently from 37029a2 to 53635c2 Compare October 31, 2024 11:19
@justinlittman justinlittman marked this pull request as ready for review October 31, 2024 11:28
README.md Outdated Show resolved Hide resolved
@justinlittman justinlittman merged commit 9fbe5cd into main Oct 31, 2024
6 checks passed
@justinlittman justinlittman deleted the robot branch October 31, 2024 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants