Warning: Can't synchronize with repository "(default)" (/home/git/ome.git does not appear to be a Git repository.). Look in the Trac log for more information.
Notice: In order to edit this ticket you need to be either: a Product Owner, The owner or the reporter of the ticket, or, in case of a Task not yet assigned, a team_member"

Task #12555 (closed)

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

Bug: client.createClient(False) in scripts fails

Reported by: jamoore Owned by: bpindelski
Priority: major Milestone: 5.1.0-m2
Component: OmeroPy Version: 5.0.3
Keywords: n.a. Cc: sbesson
Resources: n.a. Referenced By: n.a.
References: n.a. Remaining Time: 0.0d
Sprint: n.a.

Description (last modified by bpindelski)

See:

The following script fails:

import omero
from omero import scripts

c = omero.scripts.client("test.py")
copy = c.createClient(secure=False)

with

        *** start stderr (id=62)***
        * Traceback (most recent call last):
        *   File "./script", line 15, in <module>
        *     copy = c.createClient(secure=False)
        *   File "/opt/ome3/dist/lib/python/omero/clients.py", line 340, in createClient
        *     nClient = omero.client(props)
        *   File "/opt/ome3/dist/lib/python/omero/__init__.py", line 67, in client
        *     return omero.clients.BaseClient(*args, **kwargs)
        *   File "/opt/ome3/dist/lib/python/omero/clients.py", line 140, in __init__
        *     self._initData(id)
        *   File "/opt/ome3/dist/lib/python/omero/clients.py", line 263, in _initData
        *     raise omero.ClientError(msg)
        * omero.ClientError: No host specified. Use omero.client(HOSTNAME), ICE_CONFIG, or similar.
        * 
        *** end stderr ***

Change History (9)

comment:1 Changed 10 years ago by bpindelski

After some digging around the code, I can see that https://github.com/openmicroscopy/openmicroscopy/blob/develop/components/tools/OmeroPy/src/omero/scripts.py#L365 indirectly calls https://github.com/openmicroscopy/openmicroscopy/blob/develop/components/tools/OmeroPy/src/omero/scripts.py#L365, which then fails to init, as none of the parameters are provided (especially "host"). Does that mean that fixing this ticket is to guarantee some reasonable defaults for missing params in that "init" method (i.e. "localhost" if "host" not set)?

comment:2 Changed 10 years ago by jamoore

Largely what's going on here is that behind the firewall (i.e. within icegrid) we are just given Ice.Default.Router or possibly Ice.Default.Locator) since omero.host is really just a way for omero.client to build up the correct connection string outside the firewall. There are 2 rather straight-forward options as I see it:

1) parse out omero.host as I told Carnë and just set the value. This is a bit brittle but will *almost* always hold.

2) find the locations inside the firewall that are currently (wrongly) depending on omero.host and move them to using only Ice.Default.Router.

comment:3 Changed 10 years ago by bpindelski

I see. After reading the code a bit further, the error seems to stem from this line: https://github.com/openmicroscopy/openmicroscopy/blob/develop/components/tools/OmeroPy/src/omero/clients.py#L238. And the specific error message from the script executed inside the server is expected an endpoint option but found `not' in endpoint `tcp -p 4063 -h <"omero.host" not set>'. As far as I see, the line that calls getPropertyWithDefault would need a different default?
Or the whole part where the router is set in clients.py needs refactoring? This is very much Ice-specific, so I'm a bit lost here.

comment:4 Changed 10 years ago by bpindelski

As I'm not able to do

router = self.getCommunicator().stringToProxy(router)
for endpoint in router.ice_getEndpoints():
    host = endpoint.getInfo().host

because there is not communicator yet on line https://github.com/openmicroscopy/openmicroscopy/blob/develop/components/tools/OmeroPy/src/omero/clients.py#L238, I presume the sane solution is to substitute <"omero.host" not set> with localhost.

comment:5 Changed 10 years ago by jamoore

Unfortunately defaulting to localhost is dangerous. We've done that elsewhere, but unfortunately also counts as a bug (of the form that Douglas would certainly run into). Instead we would have to delay the setting until there is a communicator and/or router.

comment:6 Changed 10 years ago by bpindelski

  • Owner set to bpindelski
  • Status changed from new to accepted

comment:7 Changed 10 years ago by bpindelski

  • Description modified (diff)

comment:8 Changed 10 years ago by jamoore

  • Resolution set to fixed
  • Status changed from accepted to closed

Merged

comment:9 Changed 10 years ago by Josh Moore <josh.moore@…>

  • Remaining Time set to 0

(In [199022297b2f6d27475d006bf31f6ce0b2ff16cd/ome.git] on branch develop) Merge pull request #3121 from bpindelski/12555_create_client

Make sure @omero_host@ is never present (fix #12555).

Note: See TracTickets for help on using tickets. You may also have a look at Agilo extensions to the ticket.

1.3.13-PRO © 2008-2011 Agilo Software all rights reserved (this page was served in: 0.66247 sec.)

We're Hiring!