Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
RDMS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
researchdata
RDMS
Commits
e461daa7
Verified
Commit
e461daa7
authored
11 months ago
by
Anusha Ranganathan
Committed by
Pascal Ernster
11 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Add helper to rerun last import run
parent
d07c12b7
Branches
master
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#14292
failed
11 months ago
Stage: build
Stage: test
Stage: deploy
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
hyrax/app/controllers/bulkrax/rerun_importers_controller.rb
+2
-49
2 additions, 49 deletions
hyrax/app/controllers/bulkrax/rerun_importers_controller.rb
hyrax/app/helpers/bulkrax_helper.rb
+52
-0
52 additions, 0 deletions
hyrax/app/helpers/bulkrax_helper.rb
with
54 additions
and
49 deletions
hyrax/app/controllers/bulkrax/rerun_importers_controller.rb
+
2
−
49
View file @
e461daa7
...
@@ -2,58 +2,11 @@
...
@@ -2,58 +2,11 @@
module
Bulkrax
module
Bulkrax
class
RerunImportersController
<
ApplicationController
class
RerunImportersController
<
ApplicationController
include
BulkraxHelper
before_action
:set_importer
,
only:
[
:rerun_failed_entries
,
:marked_as_complete
]
before_action
:set_importer
,
only:
[
:rerun_failed_entries
,
:marked_as_complete
]
def
rerun_failed_entries
def
rerun_failed_entries
current_run
=
@importer
.
last_run
rerun_failed_entries_in_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
|
entry
|
next
if
entry
.
status
==
'Complete'
type
=
if
entry
.
raw_metadata
[
'model'
]
==
'CrcDataset'
'Work'
else
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::CrcDataset::Import
#{
type
}
Job"
.
constantize
.
send
(
entry
.
parser
.
perform_method
,
entry
.
id
,
@importer
.
importer_runs
.
last
.
id
)
end
current_run
.
save
elsif
current_run
&&
@importer
.
parser
.
total
.
positive?
&&
current_run
.
processed_records
.
zero?
Bulkrax
::
ImporterJob
.
send
(
@importer
.
parser
.
perform_method
,
@importer
.
id
)
end
redirect_to
importers_path
redirect_to
importers_path
end
end
...
...
This diff is collapsed.
Click to expand it.
hyrax/app/helpers/bulkrax_helper.rb
0 → 100644
+
52
−
0
View file @
e461daa7
module
BulkraxHelper
def
rerun_failed_entries_in_last_run
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
|
entry
|
next
if
entry
.
status
==
'Complete'
type
=
if
entry
.
raw_metadata
[
'model'
]
==
'CrcDataset'
'Work'
else
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::CrcDataset::Import
#{
type
}
Job"
.
constantize
.
send
(
entry
.
parser
.
perform_method
,
entry
.
id
,
@importer
.
importer_runs
.
last
.
id
)
end
current_run
.
save
elsif
current_run
&&
@importer
.
parser
.
total
.
positive?
&&
current_run
.
processed_records
.
zero?
Bulkrax
::
ImporterJob
.
send
(
@importer
.
parser
.
perform_method
,
@importer
.
id
)
end
end
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment