Skip to content
Snippets Groups Projects
Commit e1211664 authored by Kapil Patel's avatar Kapil Patel
Browse files

Fixed re-run issues

parent 970c0a7c
No related branches found
No related tags found
3 merge requests!115Tombstone not available for dataset,!930.3 release,!78Fix importer issues
Pipeline #5789 failed
......@@ -228,4 +228,12 @@ form .field-wrapper label[required="required"]::after {
.controlled_vocabulary .listing .input-group {
width: 90%;
border-radius: 4px;
}
.importer-nav-tabs {
li {
a {
padding: 10px !important;
}
}
}
\ No newline at end of file
......@@ -5,27 +5,49 @@ module Bulkrax
before_action :set_importer, only: [:rerun_failed_entries]
def rerun_failed_entries
if @importer.last_run&.failed_records&.positive?
current_run = @importer.last_run
if current_run&.failed_records&.positive?
ScheduleRelationshipsJob.set(wait: 5.minutes).perform_later(importer_id: @importer.id)
@importer.status_info('Pending')
@importer.entries.each do |failed_entry|
next if failed_entry.status == 'Complete'
@importer.entries.each do |entry|
next if entry.status == 'Complete'
type = if failed_entry.raw_metadata['model'] == 'CrcDataset'
type = if entry.raw_metadata['model'] == 'CrcDataset'
'Work'
else
failed_entry.raw_metadata['model']
entry.raw_metadata['model']
end
entry.status_info('Pending')
current_run.decrement!(:failed_records)
current_run.increment!(:enqueued_records)
if type == 'Collection'
current_run.decrement!(:failed_collections)
elsif type == 'Work'
current_run.decrement!(:failed_works)
elsif type == 'FileSet'
current_run.decrement!(:failed_file_sets)
elsif type == 'ComplexSubject'
current_run.decrement!(:failed_complex_subjects)
elsif type == 'ComplexSession'
current_run.decrement!(:failed_complex_sessions)
elsif type == 'ComplexModality'
current_run.decrement!(:failed_complex_modalities)
end
"Bulkrax::Import#{type}Job".constantize.send(
failed_entry.parser.perform_method,
failed_entry.id,
entry.parser.perform_method,
entry.id,
@importer.importer_runs.last.id
)
end
@importer.record_status
elsif @importer.last_run && @importer.parser.total.positive? && @importer.last_run.processed_records.zero?
current_run.save
elsif current_run && @importer.parser.total.positive? && current_run.processed_records.zero?
Bulkrax::ImporterJob.send(
@importer.parser.perform_method,
@importer.id
......
......@@ -88,7 +88,7 @@
<div class="bulkrax-nav-tab-bottom-margin">
<!-- Nav tabs -->
<ul class="bulkrax-nav-tab-top-margin tab-nav nav nav-tabs" role="tablist">
<ul class="bulkrax-nav-tab-top-margin tab-nav nav nav-tabs importer-nav-tabs" role="tablist">
<li role="presentation" class='active'><a href="#work-entries" aria-controls="work-entries" role="tab" data-toggle="tab">Work Entries</a></li>
<li role="presentation"><a href="#collection-entries" aria-controls="collection-entries" role="tab" data-toggle="tab">Collection Entries</a></li>
<li role="presentation"><a href="#file-set-entries" aria-controls="file-set-entries" role="tab" data-toggle="tab">File Set Entries</a></li>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment