Skip to content

csv importer should spawn ingest jobs for each work #959

Description

@rococodogs

right now ingesting is performed in a single job. if we enqueue a job for each work (after parsing metadata), we could leverage sidekiq's ability to run concurrent jobs

module Spot
  class IngestWorkJob < ::ApplicationJob
    def perform(work_type:, attributes:, depositing_user:)
      work = work_type.constantize.new
      env = Hyrax::Actors::Environment.new(work, Ability.new(depositing_user), attributes)
      Hyrax::CurationConcern.actor.create(env)
    end
  end
end

Spot::IngestWorkJob.perform_later(work_type: 'Image',
                                  attributes: { title: ['A Cool Work'] ... },
                                  depositing_user: User.find_by_username('DeposiBot'))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions