diff --git a/Gemfile b/Gemfile index 11eea763..f1d18c01 100644 --- a/Gemfile +++ b/Gemfile @@ -1,11 +1,7 @@ source 'https://rubygems.org' gem 'cube-ruby' -gem 'faraday', '~> 1.9' -gem 'ffi' -gem 'oj', '~> 3.0' gem 'rake', '~> 10.0' -gem 'redis' gem 'ruby-xxHash' group :development do diff --git a/Gemfile.lock b/Gemfile.lock index eb64cba5..225ea490 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/ncbo/goo.git - revision: 33583fd1c1d72b449cd6bb91815e3422b8448983 + revision: 70007faf43d0d96292809f89f15a27a757ccaa25 branch: develop specs: goo (0.0.2) @@ -16,7 +16,7 @@ GIT GIT remote: https://github.com/ncbo/ontologies_linked_data.git - revision: da1642ed8f9f04db2e427e35d88f235a55138d03 + revision: 013a322440b4cfd899908d15ff605799acf8e6ef branch: develop specs: ontologies_linked_data (0.0.1) @@ -53,44 +53,26 @@ GEM multi_json (~> 1.3) thread_safe (~> 0.1) tzinfo (~> 0.3.37) - addressable (2.8.6) - public_suffix (>= 2.0.2, < 6.0) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) + base64 (0.2.0) bcrypt (3.1.20) - bigdecimal (3.1.7) - builder (3.2.4) + bigdecimal (3.1.8) + builder (3.3.0) coderay (1.1.3) - concurrent-ruby (1.2.3) + concurrent-ruby (1.3.3) connection_pool (2.4.1) cube-ruby (0.0.3) date (3.3.4) docile (1.4.0) domain_name (0.6.20240107) - faraday (1.10.3) - faraday-em_http (~> 1.0) - faraday-em_synchrony (~> 1.0) - faraday-excon (~> 1.1) - faraday-httpclient (~> 1.0) - faraday-multipart (~> 1.0) - faraday-net_http (~> 1.0) - faraday-net_http_persistent (~> 1.0) - faraday-patron (~> 1.0) - faraday-rack (~> 1.0) - faraday-retry (~> 1.0) + faraday (2.8.1) + base64 + faraday-net_http (>= 2.0, < 3.1) ruby2_keywords (>= 0.0.4) - faraday-em_http (1.0.0) - faraday-em_synchrony (1.0.0) - faraday-excon (1.1.0) - faraday-httpclient (1.0.1) - faraday-multipart (1.0.4) - multipart-post (~> 2) - faraday-net_http (1.0.1) - faraday-net_http_persistent (1.2.0) - faraday-patron (1.0.0) - faraday-rack (1.0.0) - faraday-retry (1.0.3) - ffi (1.16.3) + faraday-net_http (3.0.2) http-accept (1.7.0) - http-cookie (1.0.5) + http-cookie (1.0.6) domain_name (~> 0.5) i18n (0.9.5) concurrent-ruby (~> 1.0) @@ -108,13 +90,12 @@ GEM method_source (1.1.0) mime-types (3.5.2) mime-types-data (~> 3.2015) - mime-types-data (3.2024.0305) + mime-types-data (3.2024.0702) mini_mime (1.1.5) minitest (4.7.5) multi_json (1.15.0) - multipart-post (2.4.0) net-http-persistent (2.9.4) - net-imap (0.4.10) + net-imap (0.4.14) date net-protocol net-pop (0.1.2) @@ -124,7 +105,7 @@ GEM net-smtp (0.5.0) net-protocol netrc (0.11.0) - oj (3.16.3) + oj (3.16.4) bigdecimal (>= 3.0) omni_logger (0.1.4) logger @@ -133,8 +114,8 @@ GEM pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) - public_suffix (5.0.5) - rack (3.0.10) + public_suffix (5.1.1) + rack (3.1.6) rack-test (2.1.0) rack (>= 1.3) rake (10.5.0) @@ -142,16 +123,17 @@ GEM addressable (>= 2.2) redis (5.2.0) redis-client (>= 0.22.0) - redis-client (0.22.1) + redis-client (0.22.2) connection_pool - request_store (1.6.0) + request_store (1.7.0) rack (>= 1.4) rest-client (2.1.0) http-accept (>= 1.7.0, < 2.0) http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) - rexml (3.2.6) + rexml (3.3.1) + strscan rsolr (2.6.0) builder (>= 2.1.2) faraday (>= 0.9, < 3, != 2.0.0) @@ -167,6 +149,7 @@ GEM simplecov (~> 0.19) simplecov-html (0.12.3) simplecov_json_formatter (0.1.4) + strscan (3.1.0) systemu (2.6.5) thread_safe (0.3.6) timeout (0.4.1) @@ -175,20 +158,16 @@ GEM macaddr (~> 1.0) PLATFORMS - ruby + aarch64-linux x86_64-linux DEPENDENCIES cube-ruby - faraday (~> 1.9) - ffi goo! minitest (~> 4.0) - oj (~> 3.0) ontologies_linked_data! pry rake (~> 10.0) - redis ruby-xxHash simplecov simplecov-cobertura diff --git a/dip.yml b/dip.yml new file mode 100644 index 00000000..8bf3a609 --- /dev/null +++ b/dip.yml @@ -0,0 +1,44 @@ +version: '7.1' + +# Define default environment variables to pass +# to Docker Compose +#environment: +# RAILS_ENV: development + +interaction: + # This command spins up a container with the required dependencies (solr, 4store, etc), + # and opens a terminal within it. + runner: + description: Open a Bash shell within a ncbo_annotator container (with dependencies up) + service: ruby + command: /bin/bash + + # Run a container without any dependent services + bash: + description: Run an arbitrary script within a container (or open a shell without deps) + service: ruby + command: /bin/bash + compose_run_options: [ no-deps ] + + # A shortcut to run Bundler commands + bundle: + description: Run Bundler commands + service: ruby + command: bundle + compose_run_options: [ no-deps ] + + # A shortcut to run unit tests + test: + description: Run minitest unit tests + service: ruby + command: bundle exec rake test TESTOPTS='-v' + + test-agraph: + description: Run minitest unit tests + service: ruby-agraph + command: bundle exec rake test TESTOPTS='-v' + + 'redis-cli': + description: Run Redis console + service: redis-ut + command: redis-cli -h redis-ut diff --git a/docker-compose.yml b/docker-compose.yml index 3b343882..1e7e22a4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,3 @@ -version: '3.8' - x-app: &app build: context: . @@ -15,6 +13,7 @@ x-app: &app SOLR_PROP_SEARCH_URL: http://solr-ut:8983/solr/prop_search_core1 volumes: - .:/srv/ontoportal/ncbo_annotator + - bundle:/bundle stdin_open: true tty: true command: "bundle exec rake test TESTOPTS='-v'" @@ -48,9 +47,9 @@ services: GOO_BACKEND_NAME: ag GOO_PORT: 10035 GOO_HOST: agraph-ut - GOO_PATH_QUERY: /repositories/bioportal_test - GOO_PATH_DATA: /repositories/bioportal_test/statements - GOO_PATH_UPDATE: /repositories/bioportal_test/statements + GOO_PATH_QUERY: /repositories/ontoportal_test + GOO_PATH_DATA: /repositories/ontoportal_test/statements + GOO_PATH_UPDATE: /repositories/ontoportal_test/statements depends_on: <<: *depends_on agraph-ut: @@ -59,7 +58,7 @@ services: - agraph solr-ut: - image: ontoportal/solr-ut:0.0.2 + image: ontoportal/solr-ut:0.2.0 healthcheck: test: ["CMD-SHELL", "curl -sf http://localhost:8983/solr/term_search_core1/admin/ping?wt=json | grep -iq '\"status\":\"OK\"}' || exit 1"] start_period: 3s @@ -79,7 +78,7 @@ services: image: ontoportal/mgrep:0.0.2 platform: linux/amd64 healthcheck: - test: ["CMD", "nc", "-z", "-v", "localhost", "55556"] + test: ["CMD", "nc", "-z", "-v", "127.0.0.1", "55556"] start_period: 3s interval: 10s timeout: 5s @@ -96,7 +95,7 @@ services: - 4store agraph-ut: - image: franzinc/agraph:v8.0.0 + image: franzinc/agraph:v8.2.0 platform: linux/amd64 environment: - AGRAPH_SUPER_USER=test @@ -104,12 +103,12 @@ services: shm_size: 1g command: > bash -c "/agraph/bin/agraph-control --config /agraph/etc/agraph.cfg start - ; agtool repos create bioportal_test + ; agtool repos create --supersede ontoportal_test ; agtool users add anonymous - ; agtool users grant anonymous root:bioportal_test:rw + ; agtool users grant anonymous root:ontoportal_test:rw ; tail -f /agraph/data/agraph.log" healthcheck: - test: ["CMD-SHELL", "agtool storage-report bioportal_test || exit 1"] + test: ["CMD-SHELL", "agtool storage-report ontoportal_test || exit 1"] start_period: 30s interval: 10s timeout: 5s diff --git a/lib/ncbo_annotator.rb b/lib/ncbo_annotator.rb index 4631b53a..e1e76c3b 100644 --- a/lib/ncbo_annotator.rb +++ b/lib/ncbo_annotator.rb @@ -142,10 +142,10 @@ def generate_dictionary_file() end outFile.close - redis_mgrep_dict_refresh_timestamp() + redis_mgrep_dict_refresh_timestamp end - @logger.info("Completed generating a dictionary file in #{(time/60).round(1)} minutes.") + @logger.info("Completed generating a dictionary file in #{time.round(2)} seconds.") end def create_term_cache_from_ontologies(ontologies, delete_cache=false, redis_prefix=nil) diff --git a/test/test_case.rb b/test/test_case.rb index 52476b5d..aa9817f2 100644 --- a/test/test_case.rb +++ b/test/test_case.rb @@ -48,8 +48,8 @@ def self.ontologies def before_suites # code to run before the very first test LinkedData::SampleData::Ontology.delete_ontologies_and_submissions - @@ontologies = LinkedData::SampleData::Ontology.sample_owl_ontologies - @@sty = LinkedData::SampleData::Ontology.load_semantic_types_ontology + @@ontologies = LinkedData::SampleData::Ontology.sample_owl_ontologies(process_submission: true) + @@sty = LinkedData::SampleData::Ontology.load_semantic_types_ontology(process_submission: true) annotator = Annotator::Models::NcboAnnotator.new annotator.init_redis_for_tests annotator.create_term_cache_from_ontologies(@@ontologies, true)