We're Hiring!

Better way to do chgrp

General and open developer discussion about using OMERO APIs from C++, Java, Python, Matlab and more! Please 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

If you are having trouble with custom code, please provide a link to a public repository, ideally GitHub.

Better way to do chgrp

Postby Manz » Wed Nov 07, 2012 5:19 am

Hey Guys

We've hacked a way to move datasets between groups using the command line, but Jason Swedlow mentioned it would be worth asking if there was a better way to do this. Currently I've done it via command line as below. The grand idea behind this is moving a dataset from a private group to a public one so that we can display it to the public re the public user.

Manda @ Griffith

Code: Select all

def chgrpCol(dsId,publicGroup,session):
        theAdminofGroup=cleanQuery(session)
        publicGroup=cleanQuery(publicGroup)
        dsId=cleanQuery(dsId)
        chgrpline=string.join([omerohomedir,"/bin/omero -s localhost -k ",session," chgrp '",publicGroup,"' /Dataset:",dsId ],"")
        a=subprocess.call([chgrpline],shell=True)
        logger.info(string.join(["CHGRPCOL - The collection ",str(dsId)," has been moved to the group ",str( publicGroup) , " using the line -",str(chgrpline),"- with results",str(a)],""))
        return string.join(["CHGRPCOL - The collection ",str(dsId)," has been moved to the group ", str(publicGroup)],"")

Manz
 
Posts: 72
Joined: Wed Jun 29, 2011 11:48 pm

Re: Better way to do chgrp

Postby jmoore » Thu Nov 08, 2012 9:29 am

Hi Manda,

other than not knowing what you are doing with "theAdminofGroup" the way you are doing this is certainly fine, functionally. If you are using Python as a scripting language, though, there are two further options. 1) you could use the CLI object directly and not need to use subprocess. Something like "import omero.cli" and then use "omero.cli.CLI" directly. Or perhaps 2) use the API and just invoke "omero.cmd.Chgrp". Nevertheless, all 3 are valid, and you can pick based on your particular needs.

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


Return to Developer Discussion

Who is online

Users browsing this forum: Google [Bot] and 1 guest