ome / design

OME Design proposals
http://ome.github.io/design/
1 stars 15 forks source link

Add client support for an OMERO auto-connection file on public websites #106

Open manics opened 4 years ago

manics commented 4 years ago

Background

For a long time the IDR has recommended the use of a custom connection method instead of the standard OMERO.py client or gateway methods. This was originally done to allow load-balancing since the OMERO binary protocol does not allow session pinning on a front end proxy:

This custom connection method fetches a json configuration file from the IDR website if a base hostname is provided. For example, conn = connection('idr.openmicroscopy.org', ...) will attempt to download a file connection/omero-client.json from the host using https, in this case https://idr.openmicroscopy.org/connection/omero-client.json

This connection file effectively allows custom configuration to be pushed to the clients- normally this would require code changes in the client to override the defaults, or a knowledgable user who knows and remembers to pass additional configuration to their client.

Most recently this is being used to provide a default username and password to connect to the IDR:

Future benefits to us or others include:

Proposal

Alternative: .well-known

.well-known is standard for defining well-known locations on a web server providing metadata:

We could consider using something like https://HOSTNAME/.well-known/omero/client.json instead.

joshmoore commented 4 years ago
manics commented 4 years ago

If we move to http login I think this would still work, since client.json is a set of overrides, so the following are all possible

joshmoore commented 4 years ago

Hmmm...but "port" probably doesn't make any sense via HTTP. I wonder then if it shouldn't be a different endpoint:

though maybe in a future HTTP world this all just goes away.

manics commented 4 years ago

If BlitzGateway is updated to match idr.connection it means handling a one-argument form differently from the multi-argument form:

jburel commented 4 years ago

what about the websocket case which is now critical for many notebooks/data access? everything included in omero-client.json? i.e.

[
"--Ice.Default.Router=OMERO.Glacier2/router:wss -p 443 -h idr.openmicroscopy.org -r /omero-ws",
"--omero.user=xxx",
"--omero.pass=xxx"
]
manics commented 4 years ago

Yes, that should also work if we want to switch everyone to using websockets. IIRC we've tested that before.

joshmoore commented 4 years ago

https://github.com/ome/design/issues/106#issuecomment-651832358 Is this OK?

I guess since this optionally gathers the json login info and then falls back to previous behavior (?) it would be ok. Not sure if it wouldn't be safer to have a separate class to do the next-gen login. (Another option might be something like BlitzGateway(omero.client(host))...)

manics commented 4 years ago

Existing behaviour 😀

>>> from omero.gateway import BlitzGateway
>>> c = BlitzGateway('idr.openmicroscopy.org')
Traceback (most recent call last):
  File "/venv/lib/python3.8/site-packages/omero/clients.py", line 297, in _initData
    self.__ic = Ice.initialize(id)
  File "/venv/lib/python3.8/site-packages/Ice.py", line 705, in initialize
    communicator = IcePy.Communicator(args, data)
Ice.EndpointParseException: exception ::Ice::EndpointParseException
{
    str = unrecognized argument `not' in endpoint `ssl -p 4064 -h <"omero.host" not set>'
}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/venv/lib/python3.8/site-packages/omero/gateway/__init__.py", line 1594, in __init__
    self._resetOmeroClient()
  File "/venv/lib/python3.8/site-packages/omero/gateway/__init__.py", line 2144, in _resetOmeroClient
    self.c = omero.client(
  File "/venv/lib/python3.8/site-packages/omero/__init__.py", line 67, in client
    return omero.clients.BaseClient(*args, **kwargs)
  File "/venv/lib/python3.8/site-packages/omero/clients.py", line 170, in __init__
    self._initData(id)
  File "/venv/lib/python3.8/site-packages/omero/clients.py", line 301, in _initData
    raise omero.ClientError(msg)
omero.ClientError: No host specified. Use omero.client(HOSTNAME), ICE_CONFIG, or similar.
jburel commented 4 years ago

That's the problem I mentioned on Monday and we adjust the notebook accordingly before switching to websockets

manics commented 4 years ago

@jburel Could you explain a bit more? I don't see how it's related to websockets.

jburel commented 4 years ago

it is not. I first had to adjust the way to connect then we started to use binder for most notebooks so I had to adjust anyway.