Task #4368 (closed)
Python code in one place?
|Reported by:||wmoore||Owned by:||wmoore|
|Keywords:||n.a.||Cc:||cneves, atarkowska, jamoore|
Currently, Python client developers have a number of options to connect to OMERO and a number of places to look for the functionality they require (E.g. script_utils.py).
Ideally we should provide and document a single method and place to access all functionality, or if this is not best practice then provide documentation on what is best.
- Python scripts get client from scripting service
client = scripts.client() session = client.getSession()
Should users create a blitzcon and use that for all future work?
- Are there any situations when users would NOT want to use blitzcon?
- Should some script_utils methods be moved to blitz gateway? E.g. downloadPlane()
e-mail below illustrates current confusing situation:
c = blitzcon.c s = c.sf lol, yup that's pretty much exactly the thing that I was trying to find. Will pointed me to the BlitzGateway as well and showed me how to do what I wanted with some other tricks. One was to use omero.util.script_utils.downloadPlane(RawPixelsStore, pixels, z,c,t) Given what you just told me I see that I could do this instead: blitzcon.c.sf.createGateway().getPlane(pixels_id, z, c, t, _ctx=None) Sadly, I have no clue what the difference between the two options is except that I don't need to create a RawPixelsStore object in the latter case. Any sagely advice for me here? But do note that we are in the process of refactoring BlitzGateway to unify its methods with those in Insight so this API should be considered internal for the moment. If you have suggestions, we'd love to hear them. Ah, this came up before but I think I misunderstood and thought the reference was to the other omero.gateway thing (session.createGateway()). This is definitely very concerning as I don't want to write something that becomes instantly useless. Should I do what I was doing before with omero.client(...) and client.createSession(...)? A few suggestions: Retain as much backwards compatibility as possible. If BlitzGateway is the thing that programmers should use for 90% of their needs, then make that obvious in the documentation/wiki somehow. From my perspective, getting images and image metadata is the most important thing. So the easier (and faster) that is, the happier I am. The wiki has been very useful so far, particularly omeropy/gateway. However, since I first looked at the omeropy page, I got the impression that I should be getting at everything from: >>>c = omero.client(host) >>>s = c.createSession(user, pw) So the first thing I did was start digging: >>>help(c) >>>help(s) ...and even now I'm still conflicted as to whether I should just be using this as opposed to BlitzGateway, I suppose the decision would be easier if BlitzGateway wasn't in a state of flux. In the future I'll be wanting to write data back to the database, so I'm sure I'll have more comments when I cross that bridge. Very likely, as soon as the client is inactive for 10 minutes or so. You can start by using the "omero.keep_alive" property I just discovered I that I can get at all the properties through blitzcon.c.getPropertyMap(). This is very useful. I don't see a setProperty function at that level, but could I do something like this? blitzcon.c.getProperties().setProperty('omero.keep_alive', 123456) Thanks, Adam