view · edit · sidebar · attach · print · history

< Niklaus.20180122-postgres10 | Index | Niklaus.20180116-oddb-doctors >>

20180117-oddb-ruby-250

Summary

Commits

Index

Port oddb.org to Ruby 2.5.0

Pushed the commit with the relevant changes for Ruby 2.5.0, which fixed also some unit test errors with commit Small changes to be able to run under Ruby 2.5.0

Now travis-ci reports again success with Ruby 2.4.0. Now pushed Make travis run tests for Ruby 2.4.2 2.5.0

The watir tests reported the following failures

rspec ./spec/address_correction_spec.rb[1:1] # ch.oddb.org should be possible to correct an address for a company
rspec ./spec/address_correction_spec.rb[1:2] # ch.oddb.org should be possible to correct an address for a doctor
rspec ./spec/address_correction_spec.rb[1:3] # ch.oddb.org should be possible to correct an address for a hospital
rspec ./spec/address_correction_spec.rb[1:4] # ch.oddb.org should be possible to correct an address for a pharmacy
rspec ./spec/admin_spec.rb[1:1] # ch.oddb.org should be possible to upload dummy_patinfo.pdf to a given package
rspec ./spec/admin_spec.rb[1:2] # ch.oddb.org should be possible to upload dummy_patinfo_2.pdf to a given package
rspec ./spec/evidentia_spec.rb:213 # ch.oddb.org should work all the time for Cellcept when evidenita LNF is not enabled
rspec ./spec/home_2_list_spec.rb:82 # ch.oddb.org admin in home_companies we should see all companies when logged in as admin
rspec ./spec/home_2_list_spec.rb:87 # ch.oddb.org admin in home_companies we should have the link active_companies if logged in as admin
rspec ./spec/paypal_spec.rb:113 # ch.oddb.org should show the poweruser dialog with the top left logo
rspec ./spec/preferences_spec.rb[1:1] # ch.oddb.org should save the color prefence as user 
rspec ./spec/preferences_spec.rb[1:2] # ch.oddb.org should save the color prefence as user ngiger@ywesee.com
rspec ./spec/preferences_spec.rb[1:3] # ch.oddb.org should save the color prefence as user info@desitin.ch
rspec ./spec/searchbar_spec.rb:271 # ch.oddb.org should show no drugs for Fortex via unwanted effects search
rspec ./spec/searchbar_spec.rb:325 # ch.oddb.org should set best_result when searching Rivoleve via search_type
rspec ./spec/smoketest_spec.rb:349 # ch.oddb.org desitin should show correct Tramal Tropfen Lösung zum Einnehmen ohne Dosierpumpe(4788/01/086)
rspec ./spec/smoketest_spec.rb:359 # ch.oddb.org desitin should open print fachinfo in a new window
rspec ./spec/smoketest_spec.rb[1:2:31] # ch.oddb.org desitin should have a working instant search for Inderal and going back
rspec ./spec/smoketest_spec.rb:535 # ch.oddb.org desitin should not display expired drugs, when search says active drugs only
rspec ./spec/smoketest_spec.rb[1:2:38] # ch.oddb.org desitin limiting the search to search_limitation_A using Fosfolag
rspec ./spec/smoketest_spec.rb[1:2:39] # ch.oddb.org desitin limiting the search to search_limitation_B using Allergo-X
rspec ./spec/smoketest_spec.rb[1:2:40] # ch.oddb.org desitin limiting the search to search_limitation_C using Allergo-X
rspec ./spec/smoketest_spec.rb[1:2:41] # ch.oddb.org desitin limiting the search to search_limitation_D using Elmex
rspec ./spec/smoketest_spec.rb[1:2:42] # ch.oddb.org desitin limiting the search to search_limitation_E using Holunder
rspec ./spec/smoketest_spec.rb[1:2:43] # ch.oddb.org desitin limiting the search to search_limitation_SL_only using Soolantra 10 mg
rspec ./spec/smoketest_spec.rb[1:2:44] # ch.oddb.org desitin limiting the search to search_limitation_SL_only using Methotrexat
rspec ./spec/smoketest_spec.rb[1:2:45] # ch.oddb.org desitin limiting the search to search_limitation_SL_only using mephadolor
rspec ./spec/smoketest_spec.rb[1:2:46] # ch.oddb.org desitin limiting the search to search_limitation_SL_only using Omeprazol MUT Sandoz

Running the failing unit test locally showed that the spec/address_correction_spec.rb completed without errors. Same result for

NoMethodError at /de/gcc/sort/state_id/70285747050940/sortvalue/affiliations
undefined method `collect' for 2018-01-17 08:19:02 +0100:Time
Ruby	(drbssl://localhost: in nil, line 9997
Web	GET oddb-ci2.dyndns.org/de/gcc/sort/state_id/70285747050940/sortvalue/affiliations
Jump to:
GETPOSTCookiesENV
Traceback (innermost first)
(drbssl://localhost: in nil
(drbssl://localhost: in nil
(drbssl://localhost: in nil
(drbssl://localhost: in nil
(drbssl://localhost: in nil
/var/www/oddb.org/src/view/admin/entities.rb: in wrap_all
		entities.collect { |entity|...
/var/www/oddb.org/src/view/admin/entities.rb: in init
		@model = Entities.wrap_all(@model)...
  • spec/home_2_list_spec.rb:82 shows
NoMethodError at /de/gcc/home_companies
undefined method `address' for nil:NilClass
Ruby	/var/www/oddb.org/src/view/companies/company.rb: in address_delegate, line 165
Web	GET oddb-ci2.dyndns.org/de/gcc/home_companies
Traceback (innermost first)
/var/www/oddb.org/src/view/companies/company.rb: in address_delegate
			model.address(0), @session, self)...
/var/www/oddb.org/src/view/companies/company.rb: in address
		address_delegate(model, :address)...
/var/www/oddb.org/vendor/ruby/2.5.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb: in create
  • spec/paypal_spec.rb:113 completes without error
  • spec/preferences_spec.rb completes without error
  • spec/searchbar_spec.rb:271, shows fortex, even if it was never registered. Known problem
  • spec/searchbar_spec.rb:325, completed without error
  • spec/smoketest_spec.rb was run previously without any error

If you are logged in as admin you cannot visit in the home_admin the following links "Adresssen", "Benutzer", "Neue Registration".

The problem displaying the adresses manifests, because the address_pointer was nil. But maybe the problem is rooted that ruby 2.5.0 does not sort when a time field is nil, as I see errors like

::1 - - [17/Jan/2018:09:43:40 +0100] "GET https://oddb-ci2.dyndns.org/ HTTP/1.1" 200 19079
preferences_navigation /de/gcc/home_admin/ ODDB::State::User::Preferences
::1 - - [17/Jan/2018:09:43:44 +0100] "GET https://oddb-ci2.dyndns.org/de/gcc/home_admin/ HTTP/1.1" 200 9839
could not sort: comparison of NilClass with Time failed

Checking with IRB 2.4.0 and 2.5.0

irb(main):001:0> [nil, Time.now].sort
ArgumentError: comparison of NilClass with Time failed
        from (irb):1:in `sort'
        from (irb):1
        from /home/niklaus/.rbenv/versions/2.4.0/bin/irb:11:in `<main>'
irb(main):002:0> RUBY_VERSION
=> "2.4.0"
irb(main):003:0> quit
niklaus@oddb-ci2 /v/w/oddb.org> /usr/local/bin/irb-250 
irb(main):001:0> RUBY_VERSION
=> "2.5.0"
irb(main):002:0>  [nil, Time.now].sort
Traceback (most recent call last):
        3: from /usr/local/bin/irb-250:11:in `<main>'
        2: from (irb):2
        1: from (irb):2:in `sort'
ArgumentError (comparison of NilClass with Time failed)

Also I see that on ch.oddb.org with Ruby 2.4.0 the https://ch.oddb.org/de/gcc/addresses/ are neatly sorted by time, descending, whereas in https://oddb-ci2.dyndns.org/de/gcc/addresses/ they are not and where I have many empty lines.

Running import_daily had an out of memory error

2018-01-17 09:40:54 +0100: /var/www/oddb.org/src/plugin/swissmedic.rb:194:in `show_memory_useage': Using 16922 MB of memory. Limit is 16384. Swissmedic_do_tracing true
2018-01-17 09:40:54 +0100: /var/www/oddb.org/src/plugin/swissmedic.rb:205:in `block in trace_memory_useage': Aborting as using 16922 MB of memory > than limit of 16384

By adding an init method in src/view/admin/addresses.rb, where I delete all entries which have a time == nil I can circumvent the problem. The debug output shows

Having 121 entries before delete_if
 time is nil for :!address_suggestion,37981329. 2018-01-16 16:46:27 +0100
 time is nil for :!address_suggestion,37981330. 2018-01-16 16:46:34 +0100
 time is nil for :!address_suggestion,37981331. 2018-01-16 16:46:39 +0100
 time is nil for :!address_suggestion,37981332. 2018-01-16 16:46:45 +0100
 time is nil for :!address_suggestion,37969119. 2018-01-16 16:11:15 +0100
 time is nil for :!address_suggestion,37969120. 2018-01-16 16:11:48 +0100
 time is nil for :!address_suggestion,37969121. 2018-01-16 16:12:15 +0100
 time is nil for :!address_suggestion,37969122. 2018-01-16 16:12:22 +0100
Having 113 after  delete_if

Looks like entering address_suggestions does not work anymore as it should.

Deleting the address_suggestions with a nil time field via bin/admin

ch.oddb> address_suggestions.values.find_all{ |x| !x.time }.each{ |x| x.odba_delete}
-> Array
ch.oddb> address_suggestions.values.find_all{ |x| !x.time }.size
-> 0

Running address_correction_spec.rb again, showed the following error

NoMethodError at /de/gcc
undefined method `lines' for #<Hash:0x00007fd0358adb50>
Ruby /var/www/oddb.org/src/model/address.rb: in to_diffable, line 151
Web POST oddb-ci2.dyndns.org/de/gcc
Jump to:
GET
POST
Cookies
ENV
Traceback (innermost first)
/var/www/oddb.org/src/model/address.rb: in to_diffable
          items = (element.lines  +
...
/var/www/oddb.org/src/model/address.rb: in diff
          Diffy::Diff.new(to_diffable(self), to_diffable(other), options).to_s
...
/var/www/oddb.org/src/util/persistence.rb: in issue_update
          diff = obj.diff(values, hook)
...
/var/www/oddb.org/src/util/oddbapp.rb: in block in update
   item = pointer.issue_update(self, values, origin)
...

The problem really originates that we use diffy to show the differences in src/plugin/refdata_jur.rb via changes['addresses'] = new_addr.diff(company.addresses.first).

Fixed this problem with commits

The jobs/import_swissmedic failed running export_xlxs as I did not have update /service/ch.oddb-export/run to use Ruby 2.5.0. Fixing this problem. Patch src/util/updater to run only the remaining swissmedic_followers and start jobs/import_swissmedic_followers.

On oddb-ci2 the export_xls has problems. Running it in different console. Okay. Found that the ulimit is the problem. When specifying it crashes [FATAL] failed to allocate memory. Trying to update the spreadsheet gem from 0.9.7 to 1.1.5

Increasing the ulimit to ulimit -v 3536000 (from 1536000) and trying againg, as using spreadsheet 1.1.5 did not change the problem. Now the export passed. Trying 2536000, to see how much more memory we actually need. Passed with 253600, lowering to 2036000, 2036000, 1836000. Decreasing it to 1736000 made the export aborting again. To have some margin I changed the ulimit in the /service/ch.oddb-export/run to 2036000. Remarked that on thinpower it was 10240000 (or about 6 times my limit on oddb-ci2)

Running jobs/import_bsv on oddb-ci2.

Changing ydim and ydim-html to use ruby-2.5.0 on oddb-ci2. Here I need a installed postgresql 10, as the newer pg gems need the new headers.

Installing ruby on thinpower

Installing ruby-2.5.0 on thinpower using /usr/local/src/gen_ruby_250.

As ywesee
cd /var/www/migel
git pull https://github.com/ngiger/migel.git; /usr/local/bin/bundle-250 install
cd /var/www/oddb.org
git pull https://github.com/ngiger/oddb.org.git; /usr/local/bin/bundle-250 install
cd /var/www/ydim.ywesee.org
git pull https://github.com/ngiger/ydim-html.git
bundle-250 config build.pg --with-pg-config=/usr/local/pg-10_1/bin/pg_config
bundle-250 install

Running as root

cd /usr/local/src
./gen_ruby_250
/usr/local/bin/gem-250 install yus
/usr/local/bin/gem-250 install ycurrency
# changed 240 -> in /service/yus/run
svc -h /service/yus
# checked that a login via ch.oddb.org works
# changed run in in /service/currency/run to 
exec sudo -u apache /usr/local/bin/ruby-250 /usr/local/ruby-2.5.0/bin/currencyd
svc -h /service/currency
# Checked that prices on ch.oddb.org still appear
# changed 240 -> in /service/migeld/run
svc -h /service/migeld
# checked that a migel products ch.oddb.org work
# adapt run command in
/service/ydim/run
/service/ydim-html/run
svc -h /service/ydmim*/
# update -240 -> -250 in
/service/ch.oddb*/run
svc -h /service/ch.oddb*/

Build postgresql with Attach:gen_postgresql_101.txt

Now all ch-oddb.org and ydim-services are up on thinpower.

Advertisement is missing

Looks like we have a javascript problem. Looking at the HTML source code (when not logged in) in view-source:https://ch.oddb.org/de/gcc/home_pharmacies/, we have there

<script type="text/javascript"
  src="https://pagead2.googlesyndication.com/pagead/show_ads.js">
	</script>

but nothing is show. Why? Does chrome block this?

But after a while (60 seconds or more) I suddenly see on the left side an image. See

view · edit · sidebar · attach · print · history
Page last modified on January 17, 2018, at 04:58 PM