We're Hiring!

Importing 'public' images from OMERO5.server to ImageJ

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.

Re: Importing 'public' images from OMERO5.server to ImageJ

Postby jmoore » Thu Sep 11, 2014 8:01 am

Hi Yukako,

in order to create a token with non-standard timeouts you'll need to use an admin account. We're working on creating tools for this, but for the moment you could use a script like this:
Code: Select all
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
Creates a token for another user running as an administrator.
"""

NAME = "public_user"
GROUP = "public_group"
IDLE = 0
LIVE = 60*60*24 # 1 day
ADMIN_PASS = "xxxSECRETxxx"

import omero
c = omero.client("localhost")
s = c.createSession("root", ADMIN_PASS)
try:
    service = s.getSessionService()
    principal = omero.sys.Principal()
    principal.name = NAME
    principal.group = GROUP
    principal.eventType = "User"
    session = service.createSessionWithTimeouts(principal, LIVE * 1000, IDLE * 1000)
    uuid = session.getUuid().getValue()
    idle = session.getTimeToIdle().getValue() / 1000
    live = session.getTimeToLive().getValue() / 1000
    print "Session created:"
    print "uuid=%s" % uuid
    print "idle=%s sec(s)" % idle
    print "live=%s sec(s)" % live
finally:
    c.__del__()


This will print out something like this:
Code: Select all
$ PYTHONPATH=dist/lib/python python token.py                                                                                                                                                                     
Session created:
uuid=6a41f31c-cf16-4fd1-8a89-42b89df66dd1
idle=0 sec(s)
live=86400 sec(s)


Let us know if this works for you.
Cheers,
~J.
User avatar
jmoore
Site Admin
 
Posts: 1591
Joined: Fri May 22, 2009 1:29 pm
Location: Germany

Re: Importing 'public' images from OMERO5.server to ImageJ

Postby tohsato » Thu Sep 11, 2014 8:21 am

Dear jmoore,

All interactions worked well. Many thanks!!

Yukako.
tohsato
 
Posts: 19
Joined: Mon May 20, 2013 1:28 am

Re: Importing 'public' images from OMERO5.server to ImageJ

Postby tohsato » Thu Sep 11, 2014 9:54 am

Dear jmoore,

Is there a way to specify (or fix) the string of session ID
such as "11111111-1111-1111-1111-11111111111" in your script?

Yukako.
tohsato
 
Posts: 19
Joined: Mon May 20, 2013 1:28 am

Re: Importing 'public' images from OMERO5.server to ImageJ

Postby jmoore » Thu Sep 11, 2014 10:11 am

What are you trying to achieve by specifying the UUID? In general, I don't think this is possible since it's randomly chosen by the server.

~Josh.
User avatar
jmoore
Site Admin
 
Posts: 1591
Joined: Fri May 22, 2009 1:29 pm
Location: Germany

Re: Importing 'public' images from OMERO5.server to ImageJ

Postby tohsato » Thu Sep 11, 2014 10:36 am

Dear jmoore,

I installed OMERO.server into two servers (named "ssbd1" and "ssbd2").
These servers share postgresql database. Server load dispersion system
(named "ssbd") switchs internally these servers corresponding to the loads.
Users only allow to access into "ssbd".

I might change this server's settings, when session IDs randomly chosen
by the server.

Yukako.
tohsato
 
Posts: 19
Joined: Mon May 20, 2013 1:28 am

Re: Importing 'public' images from OMERO5.server to ImageJ

Postby jmoore » Thu Sep 11, 2014 10:57 am

Oh, interesting. In general, we've only ever tested having one active OMERO pointing at a single PostgreSQL instance (with subsequent "slaves" waiting to take over). Once you've logged in with the UUID, you'll have the problem of needing to route users to the same instance that they logged in to. Have you run into this problem yet?

Cheers,
~Josh.
User avatar
jmoore
Site Admin
 
Posts: 1591
Joined: Fri May 22, 2009 1:29 pm
Location: Germany

Re: Importing 'public' images from OMERO5.server to ImageJ

Postby tohsato » Thu Sep 11, 2014 12:59 pm

Dear jmoore,

That is just as you indicated.

Cheers,
Yukako
tohsato
 
Posts: 19
Joined: Mon May 20, 2013 1:28 am

Re: Importing 'public' images from OMERO5.server to ImageJ

Postby jmoore » Thu Sep 11, 2014 2:37 pm

Hi Yukako,

how are you running the multiple instances? You could try launching multiple Blitz (in etc/grid/default.xml) rather than re-running bin/omero admin start. This would put the two services into the same "grid" at which point some of your problems may go away.

Cheers,
~Josh.
User avatar
jmoore
Site Admin
 
Posts: 1591
Joined: Fri May 22, 2009 1:29 pm
Location: Germany

Re: Importing 'public' images from OMERO5.server to ImageJ

Postby jmoore » Thu Sep 11, 2014 2:38 pm

User avatar
jmoore
Site Admin
 
Posts: 1591
Joined: Fri May 22, 2009 1:29 pm
Location: Germany

Re: Importing 'public' images from OMERO5.server to ImageJ

Postby tohsato » Fri Sep 12, 2014 5:34 am

Dear Josh,

Thanks many information. I'll check it.
We're using Heatbeat. I attached our network structure.

Regards,
Yukako
Attachments
ssbd_structure.tif
ssbd_structure.tif (77.17 KiB) Viewed 3155 times
tohsato
 
Posts: 19
Joined: Mon May 20, 2013 1:28 am

PreviousNext

Return to Developer Discussion

Who is online

Users browsing this forum: No registered users and 1 guest