Skip to content

develop: Update upgrade check handling in OMERO.web#2177

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

develop: Update upgrade check handling in OMERO.web#2177
joshmoore merged 3 commits intoome:developfrom
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-from #2176

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 ''
@mtbc
Copy link
Copy Markdown
Member

mtbc commented Mar 19, 2014

From default timeout fromUpgradeCheck('omero', url='http://134.36.64.142/') I am getting output like

2014-03-19 12:17:40.742183
ERROR:omero.util.UpgradeCheck:<urlopen error [Errno 113] No route to host>
2014-03-19 12:17:40.743741

but then again

 time nc 134.36.64.142 80
(UNKNOWN) [134.36.64.142] 80 (http) : No route to host

real    0m0.003s
user    0m0.000s
sys 0m0.000s

Is there some server that is routable but drops packets without rejecting them or something, so I can get a better hang?

@mtbc
Copy link
Copy Markdown
Member

mtbc commented Mar 19, 2014

Still to update copyrights in headers to include 2014.

@chris-allan
Copy link
Copy Markdown
Member Author

The headers have been updated by other commits in both dev_5_0 and develop since the v.4.4.0 tag that this branch is based on in. Messing around with the years in the header is going to create merge conflicts.

@mtbc
Copy link
Copy Markdown
Member

mtbc commented Mar 19, 2014

I don't seem to be able to change the timeout. For instance,

:from omero.util.upgrade_check import UpgradeCheck
:from datetime import datetime
:
:uc = UpgradeCheck('omero', timeout=10.0, url='http://10.12.2.207/')
:print datetime.now()
:uc.run()
:print datetime.now()
:--
2014-03-19 12:42:45.598970
ERROR:omero.util.UpgradeCheck:<urlopen error [Errno 113] No route to host>
2014-03-19 12:42:48.599036

(Unless there is coincidentally a three-second timeout on trying to find routes to hosts?)
I'm happy to let others decide about the importance of copyright headers, someday maybe we can just update them all based on git commit history anyway. (-:

@mtbc
Copy link
Copy Markdown
Member

mtbc commented Mar 19, 2014

Ha ha, yes, actually there is a coincidence, now can continue testing:

$ time nc 10.12.2.208 80
(UNKNOWN) [10.12.2.208] 80 (http) : No route to host

real    0m3.001s
user    0m0.000s
sys 0m0.000s

@chris-allan
Copy link
Copy Markdown
Member Author

I'm happy to change the copyright headers, just not on this branch. It'll end up being more work to change them, manage all the rebasing and conflicts than the actual code changes themselves.

Wow that's annoying with respect to the timeouts! :)

@mtbc
Copy link
Copy Markdown
Member

mtbc commented Mar 19, 2014

That's all fine, thank you: good to merge.

@chris-allan
Copy link
Copy Markdown
Member Author

@mtbc: No issues similar to @will-moore on #2176 with respect to disabling the check all together?

@mtbc
Copy link
Copy Markdown
Member

mtbc commented Mar 19, 2014

No, it's still in my xterm scrollback fortunately:

In [1]: %cpaste
Pasting code; enter '--' alone on the line to stop.
:from omero.util.upgrade_check import UpgradeCheck
:from datetime import datetime
:
:uc = UpgradeCheck('omero', url='')
:print datetime.now()
:uc.run()
:print datetime.now()
:--
2014-03-19 12:52:47.845047
2014-03-19 12:52:47.845099

Setting the time-out to 0 works fine too.

@chris-allan
Copy link
Copy Markdown
Member Author

Great. 👍

I'm going to try and do something clever on the copyright years, if it works, great otherwise I'll open a series of other PRs to update them.

@mtbc
Copy link
Copy Markdown
Member

mtbc commented Mar 19, 2014

Ah, I didn't try with bin/omero config set -- if he sees some problem you don't, I can have a go.

@chris-allan
Copy link
Copy Markdown
Member Author

You'll need to try with bin/omero config set and the OMERO.web environment variables, etc. yes as in the second stanza. I think he's now seeing everything that's expected when setting the configuration explicitly.

@will-moore
Copy link
Copy Markdown
Member

Copyright years are handled elsewhere in the web with #2149

@mtbc
Copy link
Copy Markdown
Member

mtbc commented Mar 19, 2014

Yup, all seems good. (-:

@joshmoore
Copy link
Copy Markdown
Member

See merge comment under gh-2175.

joshmoore added a commit that referenced this pull request Apr 1, 2014
develop: Update upgrade check handling in OMERO.web
@joshmoore joshmoore merged commit 9daa6b0 into ome:develop Apr 1, 2014
@sbesson sbesson added this to the 5.1.0-m1 milestone Oct 14, 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.

5 participants