[ome-devel] Group switching problem

Colin Blackburn (Staff) C.Blackburn at dundee.ac.uk
Thu Jun 18 11:04:20 BST 2015


Hi Niko,

> -----------------------------------
>> $ OM_USER=demo01
>> $ OM_PASS=some_thing
>> $ OM_SERV=vbox.omero
>> $ OM_GROUPID=84
>>
>> $ /opt/OMERO/OMERO.server/bin/omero logout
>>
>> $ /opt/OMERO/OMERO.server/bin/omero login --server $OM_SERV --user $OM_USER --password $OM_PASS --group $OM_GROUPID
>>
>>> Previously logged in to vbox.omero:4064 as demo01
>>> InternalException: Failed to connect: exception ::Glacier2::CannotCreateSessionException
>>> {
>>>    reason = No info in database for demo01
>>> }

The argument to -g or —group here is the group name rather than the group id. However, this is inconsistent with some of our other usage (where the group is not a login argument) so we will be adding an RFE to look at allowing either the name or the id.

And so something like:

bin/omero import -d 2 image.fake --group rog-0

where dataset 2 is in group rog-0 and rog-0 is not the default group works for me.

> Now my actual question is related, although not identical: as you might remember from my last email, I'm using the CLI class from the Python module omero.cli to trigger the import of an image into OMERO. Initially, I thought something like this would do:
>
>> from omero.cli import CLI
>> conn.SERVICE_OPTS.setOmeroGroup(gid)
>> cli = CLI()
>> cli.loadplugins()
>> cli._client = conn.c   # or "cli.set_client(conn.c)" for 5.1
>> import_args = ["import", '-d', '101', '/path/to/file.tif']
>> cli.invoke(import_args)
>
>
> Unfortunately, this doesn't work - I'm getting an "ome.conditions.SecurityViolation" error.
>
> What's the appropriate way of switching to the non-default group before running cli.invoke()?


The correct use of -g should be applicable in the invoke here once you have the group name.

We will, though, look at your script further - have you pushed the full script to a repository anywhere?

Cheers,

Colin


> On 17 Jun 2015, at 15:00, Niko Ehrenfeuchter <nikolaus.ehrenfeuchter at unibas.ch> wrote:
>
> Hi everybody,
>
> I'm not 100% sure, but I might have found a regression on #2951 [1] trying to specify a particular group when using the CLI, see this transcript:
>
> -----------------------------------
>> $ OM_USER=demo01
>> $ OM_PASS=some_thing
>> $ OM_SERV=vbox.omero
>> $ OM_GROUPID=84
>>
>> $ /opt/OMERO/OMERO.server/bin/omero logout
>>
>> $ /opt/OMERO/OMERO.server/bin/omero login --server $OM_SERV --user $OM_USER --password $OM_PASS --group $OM_GROUPID
>>
>>> Previously logged in to vbox.omero:4064 as demo01
>>> InternalException: Failed to connect: exception ::Glacier2::CannotCreateSessionException
>>> {
>>>    reason = No info in database for demo01
>>> }
>>
>> $ /opt/OMERO/OMERO.server/bin/omero login --server $OM_SERV --user $OM_USER --password $OM_PASS
>>
>>> Previously logged in to vbox.omero:4064 as demo01
>>> Created session 880e0d11-d303-4f89-8a90-1b7f905880e5 (demo01 at vbox.omero:4064). Idle timeout: 10.0 min. Current group: Demo Group
>>
>> $ /opt/OMERO/OMERO.server/bin/omero sessions list
>>
>>> Server     | User   | Group      | Session                              | Active    | Started
>>> ------------+--------+------------+--------------------------------------+-----------+--------------------------
>>> vbox.omero | demo01 | Demo Group | a54eb0dc-1dd1-4f81-b0b1-8c98b35752aa | Logged in | Wed Jun 17 15:42:02 2015
>>
>> $ /opt/OMERO/OMERO.server/bin/omero sessions group $OM_GROUPID
>>
>>> Using session 880e0d11-d303-4f89-8a90-1b7f905880e5 (demo01 at vbox.omero:4064). Idle timeout: 10.0 min. Current group: Demo Group
>>> Group 'Demo Group' (id=34) switched to 'Another Test Group' (id=84)
>>
>> $ /opt/OMERO/OMERO.server/bin/omero sessions list
>>
>>> Server     | User   | Group              | Session                              | Active    | Started
>>> ------------+--------+--------------------+--------------------------------------+-----------+--------------------------
>>> vbox.omero | demo01 | Another Test Group | 880e0d11-d303-4f89-8a90-1b7f905880e5 | Logged in | Wed Jun 17 15:42:02 2015
> ---------------
>
> Now my actual question is related, although not identical: as you might remember from my last email, I'm using the CLI class from the Python module omero.cli to trigger the import of an image into OMERO. Initially, I thought something like this would do:
>
>> from omero.cli import CLI
>> conn.SERVICE_OPTS.setOmeroGroup(gid)
>> cli = CLI()
>> cli.loadplugins()
>> cli._client = conn.c   # or "cli.set_client(conn.c)" for 5.1
>> import_args = ["import", '-d', '101', '/path/to/file.tif']
>> cli.invoke(import_args)
>
>
> Unfortunately, this doesn't work - I'm getting an "ome.conditions.SecurityViolation" error.
>
> What's the appropriate way of switching to the non-default group before running cli.invoke()?
>
>
> Thanks a lot!
> ~Niko
>
> [1] http://trac.openmicroscopy.org.uk/ome/ticket/2951
> --
> Niko Ehrenfeuchter | Image Analysis Specialist | Biozentrum, University of Basel | Klingelbergstr. 50/70 | CH-4056 Basel
> Phone: +41 (61) 26 72673 | nikolaus.ehrenfeuchter at unibas.ch | www.biozentrum.unibas.ch | www.microscopynetwork.unibas.ch
> _______________________________________________
> ome-devel mailing list
> ome-devel at lists.openmicroscopy.org.uk
> http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel


The University of Dundee is a registered Scottish Charity, No: SC015096


More information about the ome-devel mailing list