We're Hiring!

Omero.cli command line download/export

General user discussion about using the OMERO platform to its fullest. Please ask new questions at https://forum.image.sc/tags/omero
Please note:
Historical discussions about OMERO. Please look for and ask new questions at https://forum.image.sc/tags/omero

There are workflow guides for various OMERO functions on our help site - http://help.openmicroscopy.org

You should find answers to any basic questions about using the clients there.

Omero.cli command line download/export

Postby colmeirin » Fri Mar 28, 2014 5:07 pm

Hello,

I've been experimenting with the omcero.cli command line tool and I've succesfully logged and uploaded an image wich is abailable later via omero.insight.

Now I would like to be able to download this image( as in omero.insight [right click]>Download )

I've tried with:

bin/omero download 252 downloadedimage.jpg
(252 is the Image ID of the image I want to download)
and I get the following error:
Code: Select all
Using session 10ca1e03-1b95-4585-b54c-6adda2f80fba (root@localhost:4064). Idle t
imeout: 60.0 min. Current group: system
Traceback (most recent call last):
  File "C:\OMERO.server-5.0.0-ice34-b19\bin\\omero", line 125, in <module>
    rv = omero.cli.argv()
  File "C:\OMERO.server-5.0.0-ice34-b19\lib\python\omero\cli.py", line 1195, in
argv
    cli.invoke(args[1:])
  File "C:\OMERO.server-5.0.0-ice34-b19\lib\python\omero\cli.py", line 745, in i
nvoke
    stop = self.onecmd(line, previous_args)
  File "C:\OMERO.server-5.0.0-ice34-b19\lib\python\omero\cli.py", line 814, in o
necmd
    self.execute(line, previous_args)
  File "C:\OMERO.server-5.0.0-ice34-b19\lib\python\omero\cli.py", line 894, in e
xecute
    args.func(args)
  File "C:\OMERO.server-5.0.0-ice34-b19\lib\python\omero\plugins\download.py", l
ine 39, in __call__
    client.download(orig_file, target_file)
  File "C:\OMERO.server-5.0.0-ice34-b19\lib\python\omero\clients.py", line 756,
in download
    ofile = self.__sf.getQueryService().get("OriginalFile", ofile.id.val)
  File "C:\OMERO.server-5.0.0-ice34-b19\lib\python\omero_api_IQuery_ice.py", lin
e 117, in get
    return _M_omero.api.IQuery._op_get.invoke(self, ((klass, id), _ctx))
omero.ValidationException: exception ::omero::ValidationException
{
    serverStackTrace = ome.conditions.ValidationException: No row with the given
identifier exists: [ome.model.core.OriginalFile#252]; nested exception is org.h
ibernate.ObjectNotFoundException: No row with the given identifier exists: [ome.
model.core.OriginalFile#252]
        at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHiberna
teAccessException(SessionFactoryUtils.java:663)
        at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernate
AccessException(HibernateAccessor.java:412)
        at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(Hibern
ateTemplate.java:411)
        at org.springframework.orm.hibernate3.HibernateTemplate.execute(Hibernat
eTemplate.java:339)
        at ome.logic.QueryImpl.get(QueryImpl.java:159)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti
on(AopUtils.java:307)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo
inpoint(ReflectiveMethodInvocation.java:183)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:150)
        at ome.security.basic.EventHandler.invoke(EventHandler.java:154)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:172)
        at org.springframework.orm.hibernate3.HibernateInterceptor.invoke(Hibern
ateInterceptor.java:111)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:172)
        at org.springframework.transaction.interceptor.TransactionInterceptor.in
voke(TransactionInterceptor.java:108)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:172)
        at ome.tools.hibernate.ProxyCleanupFilter$Interceptor.invoke(ProxyCleanu
pFilter.java:241)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:172)
        at ome.services.util.ServiceHandler.invoke(ServiceHandler.java:116)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:202)
        at com.sun.proxy.$Proxy81.get(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti
on(AopUtils.java:307)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo
inpoint(ReflectiveMethodInvocation.java:183)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:150)
        at ome.security.basic.BasicSecurityWiring.invoke(BasicSecurityWiring.jav
a:98)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:172)
        at ome.services.blitz.fire.AopContextInitializer.invoke(AopContextInitia
lizer.java:43)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:202)
        at com.sun.proxy.$Proxy81.get(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at ome.services.blitz.util.IceMethodInvoker.invoke(IceMethodInvoker.java
:179)
        at ome.services.throttling.Callback.run(Callback.java:56)
        at ome.services.throttling.InThreadThrottlingStrategy.callInvokerOnRawAr
gs(InThreadThrottlingStrategy.java:56)
        at ome.services.blitz.impl.AbstractAmdServant.callInvokerOnRawArgs(Abstr
actAmdServant.java:149)
        at ome.services.blitz.impl.QueryI.get_async(QueryI.java:110)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti
on(AopUtils.java:307)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo
inpoint(ReflectiveMethodInvocation.java:183)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:150)
        at omero.cmd.CallContext.invoke(CallContext.java:78)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:202)
        at com.sun.proxy.$Proxy82.get_async(Unknown Source)
        at omero.api._IQueryTie.get_async(_IQueryTie.java:136)
        at omero.api._IQueryDisp.___get(_IQueryDisp.java:182)
        at omero.api._IQueryDisp.__dispatch(_IQueryDisp.java:528)
        at IceInternal.Incoming.invoke(Incoming.java:159)
        at Ice.ConnectionI.invokeAll(ConnectionI.java:2357)
        at Ice.ConnectionI.dispatch(ConnectionI.java:1208)
        at Ice.ConnectionI.message(ConnectionI.java:1163)
        at IceInternal.ThreadPool.run(ThreadPool.java:302)
        at IceInternal.ThreadPool.access$300(ThreadPool.java:12)
        at IceInternal.ThreadPool$EventHandlerThread.run(ThreadPool.java:643)
        at java.lang.Thread.run(Unknown Source)

    serverExceptionClass = ome.conditions.ValidationException
    message = No row with the given identifier exists: [ome.model.core.OriginalF
ile#252]; nested exception is org.hibernate.ObjectNotFoundException: No row with
the given identifier exists: [ome.model.core.OriginalFile#252]
}


Any thougs on how I can acomplish this?

Regards.
colmeirin
 
Posts: 16
Joined: Tue Mar 11, 2014 6:16 pm

Re: Omero.cli command line download/export

Postby jmoore » Mon Mar 31, 2014 7:45 pm

I think I've reproduced your issue and filed a ticket at https://trac.openmicroscopy.org.uk/ome/ticket/12146

The problem is that you are logged into a different group from the one you are trying to download from. In the mean time, you can actively change your group (as shown in the ticket) by using:
Code: Select all
  bin/omero sessions group OTHER_GROUP_NAME_OR_ID

If you're not sure of the group of the file, try:
Code: Select all
bin/omero hql --admin "select f from OriginalFile f where f.id = 252"


Cheers,
~Josh
User avatar
jmoore
Site Admin
 
Posts: 1591
Joined: Fri May 22, 2009 1:29 pm
Location: Germany

Re: Omero.cli command line download/export

Postby jmoore » Tue Apr 01, 2014 6:28 am

Colin has kindly pointed out that I found a different problem. Your issue is perhaps more straight-forward: you're trying to download via the image ID. "Download", however, only works currently for original files. "Export" works on images.

I would suspect then that
Code: Select all
bin/omero export Image:252 -f 252.ome.tiff

would download an OME-TIFF based version of your image, while
Code: Select all
bin/omero hql "select f from Image i join i.fileset as fs join fs.usedFiles as uf join uf.originalFile as f where i.id = 252"

will show you what the original file attached to the image is. Something like:
Code: Select all
# | Class         | Id    | hash                                     | name     | details             | mtime                    | path                                       | hasher               
---+---------------+-------+------------------------------------------+----------+---------------------+--------------------------+--------------------------------------------+----------------------
0 | OriginalFileI | 26806 | da39a3ee5e6b4b0d3255bfef95601890afd80709 | 252.fake | owner=852;group=853 | Tue Apr  1 08:21:27 2014 | export_tester_852/2014-04/01/08-21-25.587/ | ChecksumAlgorithmI:6
(1 row)

and you can then download using the "Id" of the original file:
Code: Select all
bin/omero download 26806 252.copy


I've filed another ticket to make that long query unnecessary, but for the moment, that should get you what you want/need. Sorry for the confusion.

~Josh.
User avatar
jmoore
Site Admin
 
Posts: 1591
Joined: Fri May 22, 2009 1:29 pm
Location: Germany

Re: Omero.cli command line download/export

Postby colmeirin » Tue Apr 01, 2014 7:57 am

Thank you Josh for your workarround and explanation.

I've tried your solution and it works perfectly.

Regards, Javier
colmeirin
 
Posts: 16
Joined: Tue Mar 11, 2014 6:16 pm


Return to User Discussion

Who is online

Users browsing this forum: No registered users and 1 guest