[ome-devel] Plan for transferring data from one OMERO to another

Eilidh Troup e.troup at epcc.ed.ac.uk
Thu Nov 9 16:07:05 GMT 2017


Hi,

I’ve run into a similar problem as last time. I’ve written a script that will upload an image to a remote OMERO server, but only from the python command line, and not from within a script running in a local OMERO. As before, the script will work from the command line or from with OMERO when transferring the image to the local OMERO server. When I try to import an image on the remote server, I get the following error: 
2017-11-09 15:16:30,696 1591       [      main] INFO       ome.formats.OMEROMetadataStoreClient - Attempting initial SSL connection to demo.openmicroscopy.org:4064 <http://demo.openmicroscopy.org:4064/>
2017-11-09 15:16:31,435 2330       [      main] ERROR  formats.importer.cli.CommandLineImporter - Error during import process.
Glacier2.PermissionDeniedException: null

The code, and full error output are below. 
I’ve also put it into a different script on gist that demonstrates the error by running it from within OMERO as a script.  https://gist.github.com/eilidh-t/e763dab7d4f3515cc85b0b6ddfb8d9f4 <https://gist.github.com/eilidh-t/e763dab7d4f3515cc85b0b6ddfb8d9f4>

Thanks for your help with this,
Eilidh


sendImageRemotely.py
================
import omero
from omero.gateway import BlitzGateway
from path import path
import sys
import subprocess
import os

file_loc = "/Users/eilidhtroup/omero/ManagedRepository/root_0/2017-10/06/" \
           "16-21-46.945/antibiotic_plate.jpg"
omero_server = "/Users/eilidhtroup/Documents/SynthSysDataManagement/omero/" \
               "omeroServer/OMERO.server"

# remote
username = ""
password = ""
remote_host = 'demo.openmicroscopy.org <http://demo.openmicroscopy.org/>'
remote_port = 4064

# connect to remote omero
c = omero.client(host=remote_host, port=remote_port, args=["--Ice.Config=/dev/null"])
c.createSession(username, password)
key = c.getSessionId()

# transfer image to remote omero
args = [sys.executable]
args.append(str(path(".") / "bin" / "omero"))
args.extend(["-s", remote_host, "-k", key, "-p", str(remote_port), "import"])
args.append(file_loc)

print "args are"
print args

# omero_server = os.environ.get('OMERO_SERVER'): # doesn't work from omero script, only from command line.

# TODO could get omero_dist as done in def omerodistdir(cls):
# from https://github.com/openmicroscopy/openmicroscopy/blob/develop/components/tools/OmeroPy/src/omero/testlib/__init__.py#L277 <https://github.com/openmicroscopy/openmicroscopy/blob/develop/components/tools/OmeroPy/src/omero/testlib/__init__.py#L277>
popen = subprocess.Popen(args, #cwd=str(self.omero_dist),
                            cwd=omero_server,
                            stdout=subprocess.PIPE,
                            stderr=subprocess.PIPE)
out, err = popen.communicate()
rc = popen.wait()
if rc != 0:
    raise Exception("import failed: [%r] %s\n%s" % (args, rc, err))
pix_ids = []
print "Output"
for x in out.split("\n"):
    print x

try:
    remote_conn = BlitzGateway(client_obj=c)
    for p in remote_conn.getObjects("Project"):
       print p.id, p.name

finally:
    c.closeSession()
    remote_conn.close()
================

> python sendImageRemotely.py 
args are
['/Users/eilidhtroup/Virtual/omero/bin/python', './bin/omero', '-s', 'demo.openmicroscopy.org <http://demo.openmicroscopy.org/>', '-k', '4b8c9563-2048-4f52-911e-f50e82fab52d', '-p', '4064', 'import', '/Users/eilidhtroup/omero/ManagedRepository/root_0/2017-10/06/16-21-46.945/antibiotic_plate.jpg']
Output
Image:7999

451 remote project
378 Project1

================

>bin/omero script launch 902
Using session eabef10d-8c5d-4b54-a7f2-1a90b354df75 (root at localhost:4064). Idle timeout: 10 min. Current group: system
ValidationException: Can't find params for 902!
stdout is in file 904:
---------------------------------
args are
['/Users/eilidhtroup/Virtual/omero/bin/python', './bin/omero', '-s', 'demo.openmicroscopy.org <http://demo.openmicroscopy.org/>', '-k', '5776f0ec-fabf-4a03-b061-85eeac9823c9', '-p', '4064', 'import', '/Users/eilidhtroup/omero/ManagedRepository/root_0/2017-10/06/16-21-46.945/antibiotic_plate.jpg']

---------------------------------
stderr is in file 905:
---------------------------------
Traceback (most recent call last):
  File "./script", line 44, in <module>
    raise Exception("import failed: [%r] %s\n%s" % (args, rc, err))
Exception: import failed: [['/Users/eilidhtroup/Virtual/omero/bin/python', './bin/omero', '-s', 'demo.openmicroscopy.org <http://demo.openmicroscopy.org/>', '-k', '5776f0ec-fabf-4a03-b061-85eeac9823c9', '-p', '4064', 'import', '/Users/eilidhtroup/omero/ManagedRepository/root_0/2017-10/06/16-21-46.945/antibiotic_plate.jpg']] 2
Joined session 5776f0ec-fabf-4a03-b061-85eeac9823c9 (etroup at demo.openmicroscopy.org <mailto:etroup at demo.openmicroscopy.org>:4064). Idle timeout: 10 min. Current group: My Data
2017-11-09 15:16:29,477 372        [      main] INFO          ome.formats.importer.ImportConfig - OMERO Version: 5.4.0-ice36-b74
2017-11-09 15:16:29,504 399        [      main] INFO          ome.formats.importer.ImportConfig - Bioformats version: 5.7.1 revision: 4d44544dc5ab8824fd3d15e74211ae97aac7e3c0 date: 20 September 2017
2017-11-09 15:16:29,549 444        [      main] INFO   formats.importer.cli.CommandLineImporter - Log levels -- Bio-Formats: ERROR OMERO.importer: INFO
2017-11-09 15:16:30,128 1023       [      main] INFO      ome.formats.importer.ImportCandidates - Depth: 4 Metadata Level: MINIMUM
2017-11-09 15:16:30,400 1295       [      main] INFO      ome.formats.importer.ImportCandidates - 1 file(s) parsed into 1 group(s) with 1 call(s) to setId in 268ms. (272ms total) [0 unknowns]
2017-11-09 15:16:30,696 1591       [      main] INFO       ome.formats.OMEROMetadataStoreClient - Attempting initial SSL connection to demo.openmicroscopy.org:4064 <http://demo.openmicroscopy.org:4064/>
2017-11-09 15:16:31,435 2330       [      main] ERROR  formats.importer.cli.CommandLineImporter - Error during import process.
Glacier2.PermissionDeniedException: null
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_20]
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_20]
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_20]
	at java.lang.reflect.Constructor.newInstance(Constructor.java:408) ~[na:1.8.0_20]
	at java.lang.Class.newInstance(Class.java:433) ~[na:1.8.0_20]
	at IceInternal.BasicStream.createUserException(BasicStream.java:2779) ~[ice.jar:na]
	at IceInternal.BasicStream.access$300(BasicStream.java:14) ~[ice.jar:na]
	at IceInternal.BasicStream$EncapsDecoder10.throwException(BasicStream.java:3298) ~[ice.jar:na]
	at IceInternal.BasicStream.throwException(BasicStream.java:2291) ~[ice.jar:na]
	at IceInternal.OutgoingAsync.throwUserException(OutgoingAsync.java:399) ~[ice.jar:na]
	at Glacier2.RouterPrxHelper.end_createSession(RouterPrxHelper.java:178) ~[glacier2.jar:na]
	at Glacier2.RouterPrxHelper.createSession(RouterPrxHelper.java:49) ~[glacier2.jar:na]
	at Glacier2.RouterPrxHelper.createSession(RouterPrxHelper.java:41) ~[glacier2.jar:na]
	at omero.client.createSession(client.java:724) ~[blitz.jar:na]
	at omero.client.joinSession(client.java:658) ~[blitz.jar:na]
	at ome.formats.OMEROMetadataStoreClient.initialize(OMEROMetadataStoreClient.java:700) ~[blitz.jar:na]
	at ome.formats.importer.ImportConfig.createStore(ImportConfig.java:378) ~[blitz.jar:na]
	at ome.formats.importer.cli.CommandLineImporter.<init>(CommandLineImporter.java:169) ~[blitz.jar:na]
	at ome.formats.importer.cli.CommandLineImporter.main(CommandLineImporter.java:955) ~[blitz.jar:na]

!! 11/09/17 15:16:31.980 error: communicator not destroyed during global destruction.
---------------------------------


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-devel/attachments/20171109/67953a91/attachment.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: not available
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-devel/attachments/20171109/67953a91/attachment.ksh>


More information about the ome-devel mailing list