-
Notifications
You must be signed in to change notification settings - Fork 8
/
ontology.rake
25 lines (24 loc) · 1.03 KB
/
ontology.rake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
namespace :ontology do
desc 'Reanalyze old ontologies'
task :reanalyze_all => :environment do
Ontology.where(parent_id: nil, present: true).order('updated_at desc').
find_each do |ontology|
if ontology.current_version.nil?
commit_oid = ontology.repository.git.get_file!(ontology.path).oid
ontology_version_options = OntologyVersionOptions.new(ontology.path,
User.where(admin: true).first)
OntologySaver.new(ontology.repository).
save_ontology(commit_oid, ontology_version_options)
else
OntologyParsingMigrationWorker.
perform_async([[ontology.current_version.id,
{fast_parse: false, files_to_parse_afterwards: []}, 1]])
Sidekiq::Client.push('queue' => 'hets-migration',
'class' => OntologyParsingWorker,
'args' => [[[ontology.current_version.id,
{fast_parse: false,
files_to_parse_afterwards: []}, 1]]])
end
end
end
end