Page 1 of 1

Better way to do chgrp

PostPosted: Wed Nov 07, 2012 5:19 am
by Manz
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)],"")


Re: Better way to do chgrp

PostPosted: Thu Nov 08, 2012 9:29 am
by jmoore
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.