Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix remote pull ontology process for zipped submissions #55

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from
Open
8 changes: 4 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ gem 'sys-proctable'
gem 'cube-ruby', require: 'cube'

# NCBO
gem 'goo', github: 'ncbo/goo', branch: 'develop'
gem 'ncbo_annotator', github: 'ncbo/ncbo_annotator', branch: 'develop'
gem 'ontologies_linked_data', github: 'ncbo/ontologies_linked_data', branch: 'develop'
gem 'sparql-client', github: 'ncbo/sparql-client', branch: 'develop'
gem 'goo', github: 'ncbo/goo', branch: 'master'
gem 'ncbo_annotator', github: 'ncbo/ncbo_annotator', branch: 'master'
gem 'ontologies_linked_data', github: 'ncbo/ontologies_linked_data', branch: 'master'
gem 'sparql-client', github: 'ncbo/sparql-client', branch: 'master'

group :test do
gem 'email_spec'
Expand Down
28 changes: 14 additions & 14 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GIT
remote: https://github.com/ncbo/goo.git
revision: 83425ba6c05d051d86c6f5775540727ce4238443
branch: develop
revision: daea7822af9e5ca1961d6873a758735133a1b2db
branch: master
specs:
goo (0.0.2)
addressable (~> 2.8)
Expand All @@ -15,8 +15,8 @@ GIT

GIT
remote: https://github.com/ncbo/ncbo_annotator.git
revision: 067104ae94c0e9d058cfbf419364fbf03f34de43
branch: develop
revision: 04226ac5840a328e6f906f15c769ee6ee5723102
branch: master
specs:
ncbo_annotator (0.0.1)
goo
Expand All @@ -26,8 +26,8 @@ GIT

GIT
remote: https://github.com/ncbo/ontologies_linked_data.git
revision: 711ebf27722355a25a0e53a8204b4ae472902bd0
branch: develop
revision: a7ad210e846a390f203457be2459719214d142fe
branch: master
specs:
ontologies_linked_data (0.0.1)
activesupport
Expand All @@ -46,8 +46,8 @@ GIT

GIT
remote: https://github.com/ncbo/sparql-client.git
revision: 55e7dbf858eb571c767bc67868f9af61663859cb
branch: develop
revision: d418d56a6c9ff5692f925b45739a2a1c66bca851
branch: master
specs:
sparql-client (1.0.1)
json_pure (>= 1.4)
Expand Down Expand Up @@ -119,16 +119,16 @@ GEM
google-cloud-env (1.6.0)
faraday (>= 0.17.3, < 3.0)
google-cloud-errors (1.3.1)
google-protobuf (3.24.3)
google-protobuf (3.24.3-x86_64-darwin)
google-protobuf (3.24.3-x86_64-linux)
google-protobuf (3.23.4)
google-protobuf (3.23.4-x86_64-darwin)
google-protobuf (3.23.4-x86_64-linux)
googleapis-common-protos (1.4.0)
google-protobuf (~> 3.14)
googleapis-common-protos-types (~> 1.2)
grpc (~> 1.27)
googleapis-common-protos-types (1.8.0)
googleapis-common-protos-types (1.9.0)
google-protobuf (~> 3.18)
googleauth (1.8.0)
googleauth (1.8.1)
faraday (>= 0.17.3, < 3.a)
jwt (>= 1.4, < 3.0)
multi_json (~> 1.11)
Expand Down Expand Up @@ -170,7 +170,7 @@ GEM
multi_json (1.15.0)
net-http-persistent (2.9.4)
netrc (0.11.0)
oj (3.16.1)
oj (3.14.2)
omni_logger (0.1.4)
logger
os (1.1.4)
Expand Down
26 changes: 8 additions & 18 deletions lib/ncbo_cron/ontology_pull.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,29 +129,14 @@ def create_submission(ont, sub, file, filename, logger = nil,
new_sub.submissionStatus = nil
new_sub.creationDate = nil
new_sub.missingImports = nil
new_sub.masterFileName = nil
new_sub.metrics = nil
full_file_path = File.expand_path(file_location)

# check if OWLAPI is able to parse the file before creating a new submission
owlapi = LinkedData::Parser::OWLAPICommand.new(
full_file_path,
File.expand_path(new_sub.data_folder.to_s),
logger: logger)
owlapi.disable_reasoner
parsable = true

begin
owlapi.parse
rescue Exception => e
logger.error("The new file for ontology #{ont.acronym}, submission id: #{submission_id} did not clear OWLAPI: #{e.class}: #{e.message}\n#{e.backtrace.join("\n\t")}")
logger.error("A new submission has NOT been created.")
logger.flush
parsable = false
end

if parsable
if new_sub.parsable?(logger: logger)
if new_sub.valid?
new_sub.save()
new_sub.save

if add_to_pull
submission_queue = NcboCron::Models::OntologySubmissionParser.new
Expand All @@ -163,9 +148,14 @@ def create_submission(ont, sub, file, filename, logger = nil,
logger.flush
end
else
logger.error("The new file for ontology #{ont.acronym}, submission id: #{submission_id} did not clear OWLAPI: #{e.class}: #{e.message}\n#{e.backtrace.join("\n\t")}")
logger.error("A new submission has NOT been created.")
logger.flush

# delete the bad file
File.delete full_file_path if File.exist? full_file_path
end

new_sub
end

Expand Down