Skip to content

Commit

Permalink
adding class instances pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni committed Dec 1, 2021
1 parent dec0949 commit 13e2a85
Show file tree
Hide file tree
Showing 9 changed files with 116 additions and 68 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ bin/**

# Support local configs
config/environments/*
!config/environments/config.rb
!config/environments/development.rb.sample
!config/environments/config.rb.sample

#ignore capistrano deployment
Expand All @@ -54,7 +54,7 @@ test/data/ontology_files/repo/**/*

config/environments/console.rb

config/environments/stage.rb
config/environments/development.rb.sample

config/environments/benchmark.rb

Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ gem 'goo', git: 'https://github.com/ontoportal-lirmm/goo.git', branch: 'master'
gem 'ncbo_annotator', git: 'https://github.com/ontoportal-lirmm/ncbo_annotator.git', branch: 'master'
gem 'ncbo_cron', git: 'https://github.com/ontoportal-lirmm/ncbo_cron.git', branch: 'master'
gem 'ncbo_ontology_recommender', git: 'https://github.com/ncbo/ncbo_ontology_recommender.git', branch: 'master'
gem 'ontologies_linked_data', git: 'https://github.com/ontoportal-lirmm/ontologies_linked_data.git', branch: 'master'
gem 'sparql-client', git: 'https://github.com/ncbo/sparql-client.git', branch: 'master'
gem 'ontologies_linked_data', git: 'https://github.com/ontoportal-lirmm/ontologies_linked_data.git', branch: 'master'

# NCBO gems (unversioned)
gem 'ncbo_resolver', git: 'https://github.com/ncbo/ncbo_resolver.git'
Expand Down
114 changes: 66 additions & 48 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
GIT
remote: https://github.com/ncbo/ncbo_ontology_recommender.git
revision: ee76178f54dc1a42b4a50028c37fb5c3d86e50da
revision: f2e4e8c7430e8c04465f6994db02dcc6f53dcf77
branch: master
specs:
ncbo_ontology_recommender (0.0.1)
Expand Down Expand Up @@ -32,7 +32,7 @@ GIT

GIT
remote: https://github.com/ncbo/sparql-client.git
revision: 87bc0e8976519cdcdef06169556677467a10fcfc
revision: fb4a89b420f8eb6dda5190a126b6c62e32c4c0c9
branch: master
specs:
sparql-client (1.0.1)
Expand Down Expand Up @@ -85,7 +85,7 @@ GIT

GIT
remote: https://github.com/ontoportal-lirmm/ontologies_linked_data.git
revision: dea417e105be60619ce4c5f5b4bb4f4ae1d48447
revision: d920eedcc78001a28dc96eb4d640c7d0d05f5001
branch: master
specs:
ontologies_linked_data (0.0.1)
Expand Down Expand Up @@ -129,29 +129,28 @@ GEM
addressable (2.3.5)
airbrussh (1.4.0)
sshkit (>= 1.6.1, != 1.7.0)
backports (3.18.2)
backports (3.21.0)
bcrypt (3.1.16)
bigdecimal (1.4.2)
builder (3.2.4)
capistrano (3.14.1)
capistrano (3.16.0)
airbrussh (>= 1.0.0)
i18n
rake (>= 10.0.0)
sshkit (>= 1.9.0)
capistrano-bundler (2.0.1)
capistrano (~> 3.1)
capistrano-locally (0.2.6)
capistrano-locally (0.3.0)
capistrano (~> 3.0)
capistrano-rbenv (2.2.0)
capistrano (~> 3.1)
sshkit (~> 1.3)
coderay (1.1.3)
concurrent-ruby (1.1.7)
concurrent-ruby (1.1.9)
cube-ruby (0.0.3)
dante (0.2.0)
declarative (0.0.20)
declarative-option (0.1.0)
docile (1.3.2)
docile (1.4.0)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
elasticsearch (2.0.0)
Expand All @@ -162,12 +161,28 @@ GEM
elasticsearch-transport (2.0.0)
faraday
multi_json
ethon (0.12.0)
ffi (>= 1.3.0)
faraday (1.1.0)
ethon (0.15.0)
ffi (>= 1.15.0)
faraday (1.8.0)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
faraday-httpclient (~> 1.0.1)
faraday-net_http (~> 1.0)
faraday-net_http_persistent (~> 1.1)
faraday-patron (~> 1.0)
faraday-rack (~> 1.0)
multipart-post (>= 1.2, < 3)
ruby2_keywords
ffi (1.13.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-net_http (1.0.1)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
faraday-rack (1.0.0)
ffi (1.15.4)
get_process_mem (0.2.7)
ffi (~> 1.0)
google-api-client (0.10.3)
Expand All @@ -179,41 +194,41 @@ GEM
mime-types (>= 1.6)
representable (~> 3.0)
retriable (>= 2.0, < 4.0)
googleauth (0.14.0)
googleauth (0.17.1)
faraday (>= 0.17.3, < 2.0)
jwt (>= 1.4, < 3.0)
memoist (~> 0.16)
multi_json (~> 1.11)
os (>= 0.9, < 2.0)
signet (~> 0.14)
haml (5.2.0)
signet (~> 0.15)
haml (5.2.2)
temple (>= 0.8.0)
tilt
http-accept (1.7.0)
http-cookie (1.0.3)
http-cookie (1.0.4)
domain_name (~> 0.5)
httpclient (2.8.3)
hurley (0.2)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
json (2.3.1)
json (2.6.1)
json-schema (2.5.0)
addressable (~> 2.3)
json_pure (2.3.1)
jwt (2.2.2)
kgio (2.11.3)
json_pure (2.6.1)
jwt (2.3.0)
kgio (2.11.4)
libxml-ruby (3.2.1)
logger (1.4.2)
logger (1.4.4)
macaddr (1.7.2)
systemu (~> 2.6.5)
mail (2.7.1)
mini_mime (>= 0.1.1)
memoist (0.16.2)
method_source (1.0.0)
mime-types (3.3.1)
mime-types (3.4.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2020.1104)
mini_mime (1.0.2)
mime-types-data (3.2021.1115)
mini_mime (1.1.2)
minitest (4.7.5)
minitest-stub_any_instance (1.0.2)
mlanett-redis-lock (0.2.7)
Expand All @@ -226,27 +241,27 @@ GEM
net-ssh (>= 2.6.5, < 7.0.0)
net-ssh (6.1.0)
netrc (0.11.0)
newrelic_rpm (6.13.1)
newrelic_rpm (8.1.0)
oj (2.18.5)
omni_logger (0.1.4)
logger
os (1.1.1)
parseconfig (1.0.8)
os (1.1.4)
parseconfig (1.1.2)
pony (1.13.1)
mail (>= 2.0)
pry (0.13.1)
pry (0.14.1)
coderay (~> 1.1)
method_source (~> 1.0)
rack (1.6.13)
rack-accept (0.4.5)
rack (>= 0.4)
rack-attack (5.4.2)
rack (>= 1.0, < 3)
rack-cache (1.12.1)
rack-cache (1.13.0)
rack (>= 0.4)
rack-cors (1.0.6)
rack (>= 1.6.0)
rack-mini-profiler (2.2.0)
rack-mini-profiler (2.3.3)
rack (>= 1.2.0)
rack-protection (1.5.5)
rack
Expand All @@ -257,13 +272,13 @@ GEM
kgio (~> 2.5)
rack (>= 1.1, < 3.0)
unicorn (~> 5.1)
raindrops (0.19.1)
raindrops (0.19.2)
rake (10.5.0)
rdf (1.0.8)
addressable (>= 2.2)
recursive-open-struct (1.1.3)
redcarpet (3.5.0)
redis (4.2.3)
redcarpet (3.5.1)
redis (4.5.1)
redis-activesupport (4.1.5)
activesupport (>= 3, < 5)
redis-store (~> 1.1.0)
Expand All @@ -273,9 +288,9 @@ GEM
redis-store (1.1.7)
redis (>= 2.2)
ref (2.0.0)
representable (3.0.4)
representable (3.1.1)
declarative (< 0.1.0)
declarative-option (< 0.2.0)
trailblazer-option (>= 0.1.1, < 0.2.0)
uber (< 0.2.0)
rest-client (2.1.0)
http-accept (>= 1.7.0, < 2.0)
Expand All @@ -287,20 +302,22 @@ GEM
builder (>= 2.1.2)
faraday (>= 0.9.0)
ruby-xxHash (0.4.0.1)
ruby2_keywords (0.0.2)
rubyzip (2.3.0)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
rufus-scheduler (2.0.24)
tzinfo (>= 0.3.22)
sequel (5.38.0)
signet (0.14.0)
sequel (5.50.0)
signet (0.15.0)
addressable (~> 2.3)
faraday (>= 0.17.3, < 2.0)
jwt (>= 1.5, < 3.0)
multi_json (~> 1.10)
simplecov (0.19.1)
simplecov (0.21.2)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.3)
sinatra (1.4.8)
rack (~> 1.5)
rack-protection (~> 1.4)
Expand All @@ -314,26 +331,27 @@ GEM
rack-test
sinatra (~> 1.4.0)
tilt (>= 1.3, < 3)
sshkit (1.21.0)
sshkit (1.21.2)
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
systemu (2.6.5)
temple (0.8.2)
tilt (2.0.10)
trailblazer-option (0.1.2)
typhoeus (1.4.0)
ethon (>= 0.9.0)
tzinfo (2.0.3)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
uber (0.1.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.7)
unicorn (5.7.0)
unf_ext (0.0.8)
unicorn (5.8.0)
kgio (~> 2.6)
raindrops (~> 0.7)
unicorn-worker-killer (0.4.4)
unicorn-worker-killer (0.4.5)
get_process_mem (~> 0)
unicorn (>= 4, < 6)
unicorn (>= 4, < 7)
uuid (2.3.9)
macaddr (~> 1.0)

Expand Down
2 changes: 1 addition & 1 deletion add_ontology_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
require_relative 'config/config'
# require_relative 'config/environments/production'
# require_relative 'config/environments/stage'
require_relative 'config/environments/development'
require_relative 'config/environments/development.rb.sample'


value_set_collections = ["NLMVS", "CEDARVS"]
Expand Down
28 changes: 14 additions & 14 deletions config/unicorn.rb
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
application = 'ontologies_api'
app_path = "/srv/ncbo/#{application}"
app_path = "/srv/ontoportal/#{application}"
working_directory "#{app_path}/current/"

worker_processes 8
timeout 180
timeout 300
preload_app true
user "ncbobp", "ncbobp"
user 'ontoportal', 'ontoportal'

stderr_path "log/unicorn.stderr.log"
#stdout_path "log/unicorn.stdout.log"
pid "/var/run/unicorn/unicorn.pid"
stderr_path 'log/unicorn.stderr.log'
stdout_path 'log/unicorn.stdout.log'
pid 'tmp/pids/unicorn.pid'

# Listen on both fast-failing unix data socket (for nginx) & a backloggable TCP connection
listen "/tmp/unicorn.sock", :backlog => 1024
listen 8088, :backlog => 256
listen app_path + '/shared/tmp/sockets/unicorn.sock', :backlog => 1024
#listen 8087, :backlog => 256

# Make sure unicorn is using current gems after rolling restarts
before_exec do |server|
ENV['BUNDLE_GEMFILE'] = "#{app_path}/current/Gemfile"
ENV['BUNDLE_GEMFILE'] = "#{app_path}/current/Gemfile"
end

before_fork do |server, worker|
# the following is highly recomended for Rails + "preload_app true"
# as there's no need for the master process to hold a connection
defined?(ActiveRecord::Base) and ActiveRecord::Base.connection.disconnect!

##
# When sent a USR2, Unicorn will suffix its pidfile with .oldbin and
# immediately start loading up a new version of itself (loaded with a new
Expand All @@ -35,9 +35,9 @@
# we send it a QUIT.
#
# Using this method we get 0 downtime deploys.

old_pid = "#{server.config[:pid]}.oldbin"

if File.exists?(old_pid) && server.pid != old_pid
begin
sig = (worker.nr + 1) >= server.worker_processes ? :QUIT : :TTOU
Expand All @@ -47,12 +47,12 @@
end
end
end

after_fork do |server, worker|
# Unicorn master loads the app then forks off workers - because of the way
# Unix forking works, we need to make sure we aren't using any of the parent's
# sockets, e.g. db connection

defined?(ActiveRecord::Base) and ActiveRecord::Base.establish_connection
# Redis and Memcached would go here but their connections are established
# on demand, so the master never opens a socket
Expand Down
3 changes: 2 additions & 1 deletion controllers/instances_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ class InstancesController < ApplicationController
check_last_modified_segment(LinkedData::Models::Class, [ont.acronym])
cls = get_class(sub)
error 404 if cls.nil?
reply LinkedData::InstanceLoader.get_instances_by_class(sub.id, cls.id)
page, size = page_params
reply LinkedData::InstanceLoader.get_instances_by_class(sub.id, cls.id, page, size)
end

namespace "/ontologies/:ontology/instances" do
Expand Down
1 change: 1 addition & 0 deletions lib/rack/slice_detection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ def initialize(app = nil, options = {})

def call(env)
if env['HTTP_HOST']

# remove the port if there is one
domain = env['HTTP_HOST'].gsub(/:\d+$/, '')

Expand Down
Loading

0 comments on commit 13e2a85

Please sign in to comment.