Skip to content

dev_5_0: Update upgrade check handling in OMERO.web#2176

Merged
joshmoore merged 3 commits intoome:dev_5_0from
chris-allan:12097-socket-timeout
Apr 1, 2014
Merged

dev_5_0: Update upgrade check handling in OMERO.web#2176
joshmoore merged 3 commits intoome:dev_5_0from
chris-allan:12097-socket-timeout

Conversation

@chris-allan
Copy link
Copy Markdown
Member

This pull requests updates the base socket timeout semantics of the OMERO.py upgrade check and allows for upgrade check configurability in OMERO.web. OMERO tickets addressed include:

To test timeouts, you will need a merge build with the changes included. Running under bin/omero shell:

from omero.util.upgrade_check import UpgradeCheck
from datetime import datetime

uc = UpgradeCheck('omero', url='http://134.36.64.142/')
print datetime.now()
uc.run()
print datetime.now()

134.36.64.142 is a University of Dundee firewalled IP address that can be used for internal or external testing. Default timeouts should be in the neighbourhood of 3 seconds. Example output:

$ bin/omero shell
WARNING:omero.util.UpgradeCheck:UPGRADE AVAILABLE:Please upgrade to 5.0.0 See http://trac.openmicroscopy.org.uk/omero for the latest version

Python 2.7.6 (default, Feb 18 2014, 10:06:14) 
Type "copyright", "credits" or "license" for more information.

IPython 1.1.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: %cpaste
Pasting code; enter '--' alone on the line to stop or use Ctrl-D.
:from omero.util.upgrade_check import UpgradeCheck
:from datetime import datetime
:
:uc = UpgradeCheck('omero', url='http://134.36.64.142/')
:print datetime.now()
:uc.run()
:print datetime.now()
:<EOF>
2014-03-18 13:27:49.661802
ERROR:omero.util.UpgradeCheck:<urlopen error timed out>
2014-03-18 13:27:52.663269

If needed the timeout can be adjusted and checked (example is a timeout of 10 seconds) by using:

...
uc = UpgradeCheck('omero', timeout=10.0, url='http://134.36.64.142/')
...

OMERO.web upgrade check configurability can also be tested with a merge build. Running under DJANGO_SETTINGS_MODULE=settings PYTHONPATH=$PYTHONPATH:lib/python/omeroweb bin/omero shell:

from omeroweb.webadmin.webadmin_utils import upgradeCheck
from datetime import datetime

print datetime.now()
upgradeCheck()
print datetime.now()

Disabled upgrade checks should return instantly. Example output:

$ bin/omero config set omero.upgrades.url ''
$ bin/omero config get
omero.upgrades.url=
$ DJANGO_SETTINGS_MODULE=settings PYTHONPATH=$PYTHONPATH:lib/python/omeroweb bin/omero shell
WARNING:omero.util.UpgradeCheck:UPGRADE AVAILABLE:Please upgrade to 5.0.0 See http://trac.openmicroscopy.org.uk/omero for the latest version

Python 2.7.6 (default, Feb 18 2014, 10:06:14) 
Type "copyright", "credits" or "license" for more information.

IPython 1.1.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: %cpaste
Pasting code; enter '--' alone on the line to stop or use Ctrl-D.
:from omeroweb.webadmin.webadmin_utils import upgradeCheck
:from datetime import datetime
:
:print datetime.now()
:upgradeCheck()
:print datetime.now()
:<EOF>
2014-03-18 13:35:25.614548
2014-03-18 13:35:25.622826

The source branch for this pull request has been based atop the v.4.4.0 tag so that it can be merged cleanly into:


--rebased-to #2175
--rebased-to #2177

Python socket timeouts are specified in seconds as floating point.  This
commit sets the default timeout to a more reasonable 3 seconds, allows
the specification of a floating point timeout value, removes the
assumption that the timeout is specified in milliseconds and documents
all of the aforementioned.
This commit adds configurability to the upgrade check URL via the
OMERO.web configuration mechanism.  Upgrade checks in OMERO.web can now
be disabled by running:

    bin/omero config set omero.web.upgrades_url ''
@will-moore
Copy link
Copy Markdown
Member

The timeouts for omero.util.upgradeCheck worked fine, although I seemed to occasionally get a 'Network is unreachable':

In [14]: uc = UpgradeCheck('omero', timeout=10, url='http://134.36.64.142/')

In [15]: print datetime.now()
2014-03-19 11:16:35.430048

In [16]: uc.run()
ERROR:omero.util.UpgradeCheck:<urlopen error [Errno 51] Network is unreachable>

For the webclient, I'm not seeing the timeout disabled - upgrade check still takes a couple of seconds after setting the url to ''.

jrs-macbookpro-25107:dist will$ omero config set omero.upgrades.url ''
jrs-macbookpro-25107:dist will$ DJANGO_SETTINGS_MODULE=settings PYTHONPATH=$PYTHONPATH:lib/python/omeroweb omero shell

In [1]: from omeroweb.webadmin.webadmin_utils import upgradeCheck

In [2]: from datetime import datetime

In [3]: print datetime.now()
2014-03-19 11:43:47.154601

In [4]: upgradeCheck()

In [5]: print datetime.now()
2014-03-19 11:43:49.299164

@chris-allan
Copy link
Copy Markdown
Member Author

Do you have OMERO_HOME set @will-moore? Are you sure that omero.upgrades.url is being set correctly inside of your dist? If you run bin/omero config set ... explicitly inside of dist rather than relying on an alias or PATH setting do you get the upgrade check being disabled?

@will-moore
Copy link
Copy Markdown
Member

Yes I do have OMERO_HOME set, but this seemed to work OK now...

$ echo $OMERO_HOME
/Users/will/Desktop/OMERO/dist
$ pwd
/Users/will/Desktop/OMERO/dist
$ bin/omero config set omero.upgrades.url ''
....

In [4]: print datetime.now()
2014-03-19 12:23:59.099813

In [5]: upgradeCheck()

In [6]: print datetime.now()
2014-03-19 12:23:59.149961

@chris-allan
Copy link
Copy Markdown
Member Author

@will-moore: Great. That's all a kind of round about way to test this all without explicitly putting debugging into OMERO.web and having a full server setup.

@sbesson sbesson added this to the 5.0.1 milestone Apr 1, 2014
@joshmoore
Copy link
Copy Markdown
Member

See merge comment under gh-2175. Merging for release of 5.0.1

joshmoore added a commit that referenced this pull request Apr 1, 2014
dev_5_0: Update upgrade check handling in OMERO.web
@joshmoore joshmoore merged commit ac83c47 into ome:dev_5_0 Apr 1, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants