Making sure OMERO python scripts clean up properly
Posted: Thu Jun 23, 2016 4:06 pm
I am writing an OMERO python script for long-running processing and have 2 questions.
Firstly, I am creating a BlitzGateway object:
and am wondering if/how I need to close it in a finally block before I do client.closeSession() -- do I need to use .seppuku(), or is this not necessary? (or should I be accessing the gateway in a different way in the first place?)
Secondly, it seems that if I start the script and then log out from my (web) client session, the script dies but my finally block is never reached, and temporary files are therefore not cleaned up. Is this expected behaviour? (or have I made a mistake?) Is there a way I can make sure my cleanup code is always run? If I start the script and close the browser tab without logging out, the session & script continue to run.
Note that I have been testing with a 5.0 server installation, so if there have been updates related to these issues since 5.0, please let me know and I will try with 5.2
Thanks, Graeme
Firstly, I am creating a BlitzGateway object:
- Code: Select all
conn = BlitzGateway(client_obj=client)
and am wondering if/how I need to close it in a finally block before I do client.closeSession() -- do I need to use .seppuku(), or is this not necessary? (or should I be accessing the gateway in a different way in the first place?)
Secondly, it seems that if I start the script and then log out from my (web) client session, the script dies but my finally block is never reached, and temporary files are therefore not cleaned up. Is this expected behaviour? (or have I made a mistake?) Is there a way I can make sure my cleanup code is always run? If I start the script and close the browser tab without logging out, the session & script continue to run.
Note that I have been testing with a 5.0 server installation, so if there have been updates related to these issues since 5.0, please let me know and I will try with 5.2
Thanks, Graeme