We're Hiring!

Keeping alive the session from the omero shell

General and open developer discussion about using OMERO APIs from C++, Java, Python, Matlab and more! Please new questions at https://forum.image.sc/tags/omero
Please note:
Historical discussions about OMERO. Please look for and ask new questions at https://forum.image.sc/tags/omero

If you are having trouble with custom code, please provide a link to a public repository, ideally GitHub.

Keeping alive the session from the omero shell

Postby icaoberg » Tue Oct 05, 2010 4:16 pm

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:
icaoberg
 
Posts: 145
Joined: Fri Sep 17, 2010 9:05 pm
Location: Pittsburgh, PA

Re: Keeping alive the session from the omero shell

Postby jmoore » Tue Oct 05, 2010 4:29 pm

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.
User avatar
jmoore
Site Admin
 
Posts: 1591
Joined: Fri May 22, 2009 1:29 pm
Location: Germany

Re: Keeping alive the session from the omero shell

Postby icaoberg » Tue Oct 05, 2010 4:34 pm

does this method return a timer/object? what is the optimal time (in seconds) in your opinion?
icaoberg
 
Posts: 145
Joined: Fri Sep 17, 2010 9:05 pm
Location: Pittsburgh, PA

Re: Keeping alive the session from the omero shell

Postby jmoore » Tue Oct 05, 2010 5:27 pm

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
User avatar
jmoore
Site Admin
 
Posts: 1591
Joined: Fri May 22, 2009 1:29 pm
Location: Germany


Return to Developer Discussion

Who is online

Users browsing this forum: No registered users and 1 guest