Skip to content

Commit

Permalink
alias indexes for provider and client. #302
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Jul 11, 2019
1 parent fa277d1 commit 7f508a9
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 21 deletions.
45 changes: 35 additions & 10 deletions lib/tasks/client.rake
Original file line number Diff line number Diff line change
@@ -1,17 +1,47 @@
namespace :client do
desc "Create index for clients"
task :create_index => :environment do
Client.__elasticsearch__.create_index!
puts Client.create_index
end

desc "Delete index for clients"
task :delete_index => :environment do
Client.__elasticsearch__.delete_index!
puts Client.delete_index
end

desc "Refresh index for clients"
task :refresh_index => :environment do
Client.__elasticsearch__.refresh_index!
desc "Upgrade index for clients"
task :upgrade_index => :environment do
puts Client.upgrade_index
end

desc "Switch index for clients"
task :switch_index => :environment do
puts Client.switch_index
end

desc "Return active index for clients"
task :active_index => :environment do
puts Client.active_index + " is the active index."
end

desc "Start using alias indexes for clients"
task :start_aliases => :environment do
puts Client.start_aliases
end

desc "Monitor reindexing for clients"
task :monitor_reindex => :environment do
puts Client.monitor_reindex
end

desc "Wrap up starting using alias indexes for clients"
task :finish_aliases => :environment do
puts Client.finish_aliases
end

desc 'Import all clients'
task :import => :environment do
Provider.import(index: Client.inactive_index)
end

desc 'Index DOIs by client'
Expand All @@ -32,11 +62,6 @@ namespace :client do
client.index_all_dois
end

desc 'Import all clients'
task :import => :environment do
Client.import
end

desc 'Import DOIs by client'
task :import_all_dois => :environment do
if ENV['CLIENT_ID'].nil?
Expand Down
46 changes: 35 additions & 11 deletions lib/tasks/provider.rake
Original file line number Diff line number Diff line change
@@ -1,22 +1,46 @@
namespace :provider do
desc 'Import all providers'
task :import => :environment do
Provider.__elasticsearch__.create_index!
Provider.import
end

desc "Create index for providers"
task :create_index => :environment do
Provider.__elasticsearch__.create_index!
puts Provider.create_index
end

desc "Delete index for providers"
task :delete_index => :environment do
Provider.__elasticsearch__.delete_index!
puts Provider.delete_index
end

desc "Upgrade index for providers"
task :upgrade_index => :environment do
puts Provider.upgrade_index
end

desc "Switch index for providers"
task :switch_index => :environment do
puts Provider.switch_index
end

desc "Return active index for providers"
task :active_index => :environment do
puts Provider.active_index + " is the active index."
end

desc "Start using alias indexes for providers"
task :start_aliases => :environment do
puts Provider.start_aliases
end

desc "Monitor reindexing for providers"
task :monitor_reindex => :environment do
puts Provider.monitor_reindex
end

desc "Refresh index for providers"
task :refresh_index => :environment do
Provider.__elasticsearch__.refresh_index!
desc "Wrap up starting using alias indexes for providers"
task :finish_aliases => :environment do
puts Provider.finish_aliases
end

desc 'Import all providers'
task :import => :environment do
Provider.import(index: Provider.inactive_index)
end
end

0 comments on commit 7f508a9

Please sign in to comment.