Skip to content

Commit fc90752

Browse files
authored
Merge pull request #130 from ontoportal-lirmm/pl/add-java-heap-size-configuration-variable
Add java heap size configuration variable
2 parents da2bfd2 + 0568286 commit fc90752

4 files changed

Lines changed: 38 additions & 34 deletions

File tree

config/config.rb.sample

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LinkedData.config do |config|
66
config.repository_folder = "./test/data/ontology_files/repo"
77
config.rest_url_prefix = "http://data.bioontology.org/"
88
config.enable_security = false
9-
9+
config.java_max_heap_size = '10240M'
1010
#PURL server config parameters
1111
config.enable_purl = false
1212
config.purl_host = "purl.bioontology.org"

lib/ontologies_linked_data/config/config.rb

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -15,67 +15,69 @@ def config(&block)
1515
overide_connect_goo = false
1616

1717
# Set defaults
18-
@settings.goo_backend_name ||= "4store"
18+
@settings.goo_backend_name ||= '4store'
1919
@settings.goo_port ||= 9000
20-
@settings.goo_host ||= "localhost"
21-
@settings.goo_path_query ||= "/sparql/"
22-
@settings.goo_path_data ||= "/data/"
23-
@settings.goo_path_update ||= "/update/"
24-
@settings.search_server_url ||= "http://localhost:8983/solr/term_search_core1"
25-
@settings.property_search_server_url ||= "http://localhost:8983/solr/prop_search_core1"
26-
@settings.repository_folder ||= "./test/data/ontology_files/repo"
27-
@settings.rest_url_prefix ||= "http://data.bioontology.org/"
20+
@settings.goo_host ||= 'localhost'
21+
@settings.goo_path_query ||= '/sparql/'
22+
@settings.goo_path_data ||= '/data/'
23+
@settings.goo_path_update ||= '/update/'
24+
@settings.search_server_url ||= 'http://localhost:8983/solr/term_search_core1'
25+
@settings.property_search_server_url ||= 'http://localhost:8983/solr/prop_search_core1'
26+
@settings.repository_folder ||= './test/data/ontology_files/repo'
27+
@settings.rest_url_prefix ||= 'http://data.bioontology.org/'
2828
@settings.enable_security ||= false
2929
@settings.enable_slices ||= false
3030

31+
# Java/JVM options
32+
@settings.java_max_heap_size ||= '10240M'
3133
### these params should be not ussed any more
3234
# removed so that dependencies shout
3335
#
3436
# @settings.redis_host ||= "localhost"
3537
# @settings.redis_port ||= 6379
3638
# ###
3739

38-
@settings.ui_host ||= "bioportal.bioontology.org"
40+
@settings.ui_host ||= 'bioportal.bioontology.org'
3941
@settings.replace_url_prefix ||= false
40-
@settings.id_url_prefix ||= "http://data.bioontology.org/"
42+
@settings.id_url_prefix ||= 'http://data.bioontology.org/'
4143
@settings.queries_debug ||= false
4244
@settings.enable_monitoring ||= false
43-
@settings.cube_host ||= "localhost"
45+
@settings.cube_host ||= 'localhost'
4446
@settings.cube_port ||= 1180
4547

4648
# Caching http
4749
@settings.enable_http_cache ||= false
48-
@settings.http_redis_host ||= "localhost"
50+
@settings.http_redis_host ||= 'localhost'
4951
@settings.http_redis_port ||= 6379
5052

5153
#Caching goo
52-
@settings.goo_redis_host ||= "localhost"
54+
@settings.goo_redis_host ||= 'localhost'
5355
@settings.goo_redis_port ||= 6379
5456

5557
#Ontology Analytics Redis
56-
@settings.ontology_analytics_redis_host ||= "localhost"
58+
@settings.ontology_analytics_redis_host ||= 'localhost'
5759
@settings.ontology_analytics_redis_port ||= 6379
5860

5961
# PURL server config parameters
6062
@settings.enable_purl ||= false
61-
@settings.purl_host ||= "purl.bioontology.org"
63+
@settings.purl_host ||= 'purl.bioontology.org'
6264
@settings.purl_port ||= 80
63-
@settings.purl_username ||= ""
64-
@settings.purl_password ||= ""
65-
@settings.purl_maintainers ||= ""
66-
@settings.purl_target_url_prefix ||= "http://bioportal.bioontology.org"
65+
@settings.purl_username ||= ''
66+
@settings.purl_password ||= ''
67+
@settings.purl_maintainers ||= ''
68+
@settings.purl_target_url_prefix ||= 'http://bioportal.bioontology.org'
6769

6870
# Email settings
6971
@settings.enable_notifications ||= false
70-
@settings.email_sender ||= "admin@example.org" # Default sender for emails
71-
@settings.email_override ||= "test.email@example.org" # By default, all email gets sent here. Disable with email_override_disable.
72+
@settings.email_sender ||= 'admin@example.org' # Default sender for emails
73+
@settings.email_override ||= 'test.email@example.org' # By default, all email gets sent here. Disable with email_override_disable.
7274
@settings.email_disable_override ||= false
73-
@settings.smtp_host ||= "localhost"
75+
@settings.smtp_host ||= 'localhost'
7476
@settings.smtp_port ||= 25
75-
@settings.smtp_user ||= "user"
76-
@settings.smtp_password ||= "password"
77+
@settings.smtp_user ||= 'user'
78+
@settings.smtp_password ||= 'password'
7779
@settings.smtp_auth_type ||= :none # :none, :plain, :login, :cram_md5
78-
@settings.smtp_domain ||= "localhost.localhost"
80+
@settings.smtp_domain ||= 'localhost.localhost'
7981
@settings.enable_starttls_auto ||= false # set to true for use with gmail
8082

8183
# number of times to retry a query when empty records are returned
@@ -89,19 +91,19 @@ def config(&block)
8991

9092
unless @settings.redis_host.nil?
9193
puts "Error: 'redis_host' is not a valid conf parameter."
92-
puts " Redis databases were split into multiple hosts (09/22/13)."
93-
raise Exception, "redis_host is not a valid conf parameter."
94+
puts ' Redis databases were split into multiple hosts (09/22/13).'
95+
raise Exception, 'redis_host is not a valid conf parameter.'
9496
end
9597

9698
# Check to make sure url prefix has trailing slash
97-
@settings.rest_url_prefix = @settings.rest_url_prefix + "/" unless @settings.rest_url_prefix[-1].eql?("/")
99+
@settings.rest_url_prefix = @settings.rest_url_prefix + '/' unless @settings.rest_url_prefix[-1].eql?('/')
98100

99101
puts "(LD) >> Using rdf store #{@settings.goo_host}:#{@settings.goo_port}"
100102
puts "(LD) >> Using term search server at #{@settings.search_server_url}"
101103
puts "(LD) >> Using property search server at #{@settings.property_search_server_url}"
102-
puts "(LD) >> Using HTTP Redis instance at "+
104+
puts '(LD) >> Using HTTP Redis instance at '+
103105
"#{@settings.http_redis_host}:#{@settings.http_redis_port}"
104-
puts "(LD) >> Using Goo Redis instance at "+
106+
puts '(LD) >> Using Goo Redis instance at '+
105107
"#{@settings.goo_redis_host}:#{@settings.goo_redis_port}"
106108

107109
connect_goo unless overide_connect_goo

lib/ontologies_linked_data/diff/bubastis_diff.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def initialize(input_fileOld, input_fileNew)
4343
@input_fileNew = input_fileNew
4444
@output_repo = File.expand_path(@input_fileNew).gsub(File.basename(@input_fileNew),'')
4545
@file_diff_path = nil
46+
@java_heap_size = LinkedData.settings.java_max_heap_size
4647
end
4748

4849
def setup_environment
@@ -83,7 +84,7 @@ def call_bubastis_java_cmd
8384
end
8485
errors_log = File.join([@output_repo, "bubastis_diff_errors.log"])
8586
File.delete errors_log if File.exist? errors_log
86-
java_cmd = "java -DentityExpansionLimit=1500000 -Xmx5120M -jar #{@bubastis_jar_path} #{options.join(' ')}"
87+
java_cmd = "java -DentityExpansionLimit=1500000 -Xmx#{@java_heap_size} -jar #{@bubastis_jar_path} #{options.join(' ')}"
8788
Diff.logger.info("Java call [#{java_cmd}]")
8889
stdout,stderr,status = Open3.capture3(java_cmd)
8990
if not status.success?

lib/ontologies_linked_data/parser/owlapi.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def initialize(input_file, output_repo, opts = {})
2121
@file_triples_path = nil
2222
@missing_imports = nil
2323
@reasoning = true
24+
@java_heap_size = LinkedData.settings.java_max_heap_size
2425
end
2526

2627
def setup_environment
@@ -71,7 +72,7 @@ def call_owlapi_java_command
7172
if File.exist? errors_log
7273
File.delete errors_log
7374
end
74-
command_call = "java -DentityExpansionLimit=2500000 -Xmx10240M -jar #{@owlapi_wrapper_jar_path} #{options}"
75+
command_call = "java -DentityExpansionLimit=2500000 -Xmx#{@java_heap_size} -jar #{@owlapi_wrapper_jar_path} #{options}"
7576
@logger.info("Java call [#{command_call}]")
7677
Open3.popen3(command_call) do |i,o,e,w|
7778
i.close

0 commit comments

Comments
 (0)