Page 1 of 1

Keeping alive the session from the omero shell

PostPosted: Tue Oct 05, 2010 4:16 pm
by icaoberg
I am testing some of my code through the shell. Is there a method to keep the session alive while doing this? I know OMERO Matlab creates a timer. :geek:

Re: Keeping alive the session from the omero shell

PostPosted: Tue Oct 05, 2010 4:29 pm
by jmoore
In Python, there's omero.client.enableKeepAlive(seconds) which you can use interactively.

If you really want to keep the session alive from the console (i.e. from bash), you can use:
Code: Select all
~/code/omero.git/dist $ bin/omero sessions keepalive
Using session 5627d37a-d2d2-4e09-b396-2e6357c561ed (root@localhost). Idle timeout: 10.0 min. Current group: system
Running keep alive every 60 seconds
Press enter to cancel.


~Josh.

Re: Keeping alive the session from the omero shell

PostPosted: Tue Oct 05, 2010 4:34 pm
by icaoberg
does this method return a timer/object? what is the optimal time (in seconds) in your opinion?

Re: Keeping alive the session from the omero shell

PostPosted: Tue Oct 05, 2010 5:27 pm
by jmoore
enableKeepAlive doesn't return anything. All it does it handle the setting of omero.keep_alive which you could also do via your configuration file (see etc/ice.config for an example). You can disable the keep alive again by choosing any value 0 or less. As well, when you call client.closeSession, the keep alive thread is stopped.

The optimal depends on your specific configuration, but the default is 10 minutes:
Code: Select all
# from etc/omero.properties
omero.sessions.timeout=600000


If you choose a value half of this you should be safe. Choosing a value which is a third means that if one of the keep alives fail for network reasons, you can still recover. 3 minutes seems very reasonable then.

Cheers,
~Josh.

See also: http://hudson.openmicroscopy.org.uk/job/OMERO/javadoc/epydoc/omero.clients.BaseClient-class.html#enableKeepAlive