Skip to content

Commit

Permalink
implemented #19, #31, and #32
Browse files Browse the repository at this point in the history
  • Loading branch information
mdorf committed Jul 8, 2020
1 parent 10fff71 commit 74229aa
Show file tree
Hide file tree
Showing 5 changed files with 199 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ GIT

GIT
remote: https://github.com/ncbo/ncbo_annotator.git
revision: 722817503b3effe5ea16c2eb5c10d145808fb6d8
revision: c5b78b13ef9e5a77034072303ee8336ae4b3097b
branch: staging
specs:
ncbo_annotator (0.0.1)
Expand All @@ -27,7 +27,7 @@ GIT

GIT
remote: https://github.com/ncbo/ontologies_linked_data.git
revision: 15859fe491ec2f3790db04739c9939eb8a7cf909
revision: ba5f3c41d7d4ea9102fa508e8a0e14cb6d6a6115
branch: staging
specs:
ontologies_linked_data (0.0.1)
Expand Down Expand Up @@ -144,7 +144,7 @@ GEM
hurley (0.2)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
json (2.3.0)
json (2.3.1)
json_pure (2.3.0)
jwt (2.2.1)
launchy (2.4.3)
Expand Down
65 changes: 65 additions & 0 deletions bin/ncbo_ontology_analytics_rebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/usr/bin/env ruby

# Exit cleanly from an early interrupt
Signal.trap("INT") { exit 1 }

# Setup the bundled gems in our environment
require 'bundler/setup'

# Configure the process for the current cron configuration.
require_relative '../lib/ncbo_cron'
config_exists = File.exist?(File.expand_path('../../config/config.rb', __FILE__))
abort("Please create a config/config.rb file using the config/config.rb.sample as a template") unless config_exists
require_relative '../config/config'

platform = "local"
if LinkedData.settings.goo_host.include? "stage"
platform = "stage"
elsif LinkedData.settings.goo_host.include? "prod"
platform = "prod"
end
puts "Running on #{platform} platform"

require 'uri'
require 'benchmark'
require 'optparse'

options = {}
opt_parser = OptionParser.new do |opts|
# Set a banner, displayed at the top of the help screen.
opts.banner = "Usage: #{File.basename(__FILE__)} [options]"

options[:logfile] = STDOUT
opts.on( '-l', '--logfile FILE', "Write log to FILE (default is STDOUT)" ) do |filename|
options[:logfile] = filename
end

# Display the help screen, all programs are assumed to have this option.
opts.on( '-h', '--help', 'Display this screen' ) do
puts opts
exit
end
end

opt_parser.parse!
logger = nil

begin
logger = Logger.new(options[:logfile])
puts "Processing details are logged to #{options[:logfile] == STDOUT ? "STDOUT" : options[:logfile]}"
msg = "Rebuilding ontology analytics repository"
puts msg
logger.info(msg)

time = Benchmark.realtime do
NcboCron::Models::OntologyAnalytics.new(logger).run
end
msg = "Completed rebuilding ontology analytics repository in #{(time/60).round(1)} minutes."
puts msg
logger.info(msg)
rescue Exception => e
msg = "Failed rebuilding ontology analytics repository with exception: #{e.class}: #{e.message}\n#{e.backtrace.join("\n")}"
logger.error(msg)
puts msg
exit(1)
end
65 changes: 65 additions & 0 deletions bin/ncbo_ontology_rank_rebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/usr/bin/env ruby

# Exit cleanly from an early interrupt
Signal.trap("INT") { exit 1 }

# Setup the bundled gems in our environment
require 'bundler/setup'

# Configure the process for the current cron configuration.
require_relative '../lib/ncbo_cron'
config_exists = File.exist?(File.expand_path('../../config/config.rb', __FILE__))
abort("Please create a config/config.rb file using the config/config.rb.sample as a template") unless config_exists
require_relative '../config/config'

platform = "local"
if LinkedData.settings.goo_host.include? "stage"
platform = "stage"
elsif LinkedData.settings.goo_host.include? "prod"
platform = "prod"
end
puts "Running on #{platform} platform"

require 'uri'
require 'benchmark'
require 'optparse'

options = {}
opt_parser = OptionParser.new do |opts|
# Set a banner, displayed at the top of the help screen.
opts.banner = "Usage: #{File.basename(__FILE__)} [options]"

options[:logfile] = STDOUT
opts.on( '-l', '--logfile FILE', "Write log to FILE (default is STDOUT)" ) do |filename|
options[:logfile] = filename
end

# Display the help screen, all programs are assumed to have this option.
opts.on( '-h', '--help', 'Display this screen' ) do
puts opts
exit
end
end

opt_parser.parse!
logger = nil

begin
logger = Logger.new(options[:logfile])
puts "Processing details are logged to #{options[:logfile] == STDOUT ? "STDOUT" : options[:logfile]}"
msg = "Rebuilding ontology rank repository"
puts msg
logger.info(msg)

time = Benchmark.realtime do
NcboCron::Models::OntologyRank.new(logger).run
end
msg = "Completed rebuilding ontology rank repository in #{time.round(1)} seconds."
puts msg
logger.info(msg)
rescue Exception => e
msg = "Failed rebuilding ontology rank repository with exception: #{e.class}: #{e.message}\n#{e.backtrace.join("\n")}"
logger.error(msg)
puts msg
exit(1)
end
65 changes: 65 additions & 0 deletions bin/ncbo_ontology_report_rebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/usr/bin/env ruby

# Exit cleanly from an early interrupt
Signal.trap("INT") { exit 1 }

# Setup the bundled gems in our environment
require 'bundler/setup'

# Configure the process for the current cron configuration.
require_relative '../lib/ncbo_cron'
config_exists = File.exist?(File.expand_path('../../config/config.rb', __FILE__))
abort("Please create a config/config.rb file using the config/config.rb.sample as a template") unless config_exists
require_relative '../config/config'

platform = "local"
if LinkedData.settings.goo_host.include? "stage"
platform = "stage"
elsif LinkedData.settings.goo_host.include? "prod"
platform = "prod"
end
puts "Running on #{platform} platform"

require 'uri'
require 'benchmark'
require 'optparse'

options = {}
opt_parser = OptionParser.new do |opts|
# Set a banner, displayed at the top of the help screen.
opts.banner = "Usage: #{File.basename(__FILE__)} [options]"

options[:logfile] = STDOUT
opts.on( '-l', '--logfile FILE', "Write log to FILE (default is STDOUT)" ) do |filename|
options[:logfile] = filename
end

# Display the help screen, all programs are assumed to have this option.
opts.on( '-h', '--help', 'Display this screen' ) do
puts opts
exit
end
end

opt_parser.parse!
logger = nil

begin
logger = Logger.new(options[:logfile])
puts "Processing details are logged to #{options[:logfile] == STDOUT ? "STDOUT" : options[:logfile]}"
msg = "Rebuilding ontologies report"
puts msg
logger.info(msg)

time = Benchmark.realtime do
NcboCron::Models::OntologiesReport.new(logger).run
end
msg = "Completed rebuilding ontologies report in #{(time/60).round(1)} minutes."
puts msg
logger.info(msg)
rescue Exception => e
msg = "Failed rebuilding ontologies report with exception: #{e.class}: #{e.message}\n#{e.backtrace.join("\n")}"
logger.error(msg)
puts msg
exit(1)
end
1 change: 1 addition & 0 deletions lib/ncbo_cron.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
require_relative 'ncbo_cron/query_caching'
require_relative 'ncbo_cron/ontologies_report'
require_relative 'ncbo_cron/ontology_analytics'
require_relative 'ncbo_cron/ontology_rank'
require_relative 'ncbo_cron/spam_deletion'
require_relative 'ncbo_cron/mapping_counts'
require_relative 'ncbo_cron/update_manager'
Expand Down

0 comments on commit 74229aa

Please sign in to comment.