forked from ontoportal/ncbo_cron
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
199 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters