Page 1 of 1

dataset and project creation on the commandline?

PostPosted: Wed Jan 26, 2011 8:24 pm
by helmerj
In order to import more than 100.000 images in one go I am working on a ruby import script.
Is it possible to create datasets and projects on the commandline? I was looking through the bin/omero commands and couldn't find anything. So far I will have to have a dataset before starting an import process. Very inconvenient...

I would also need to chown datasets inside the DB.

can any of this be done?

If not tool is available for this. where can I find documentation on the dataset/projection creation process. Doe I need the creation_id and update_id as well as the entries events or can I scrape by without them?

Cheers
Juergen

Re: dataset and project creation on the commandline?

PostPosted: Thu Jan 27, 2011 12:01 pm
by jmoore
Hi Juergen,

there's not (yet) any CLI command to create hierarchies, but here's a small shell script which should get you started:
Code: Select all
#!/bin/bash
#
# An example of how to use the command-line
# to launch an arbitrary python script.
#

#
# Configuration:
# -------------
#
export PATH=$PATH:dist/bin
export PYTHONPATH=$PYTHONPATH:dist/lib/python

omero login
export ICE_CONFIG=`omero sessions file`

cat - >> new_dataset.py << EOF
import sys
import omero
from omero.rtypes import rstring
from omero_ext import argparse

client = omero.client()
session = client.getProperty("omero.sess")
session = client.joinSession(session)

p = argparse.ArgumentParser()
p.add_argument("--name", type=omero.rtypes.rstring, default="Somename")
p.add_argument("--description", type=omero.rtypes.rstring, default="")
ns, other = p.parse_known_args(sys.argv)

updateService = session.getUpdateService()

d = omero.model.DatasetI()
d.setName(ns.name)
d.setDescription(ns.description)
d = updateService.saveAndReturnObject(d)

print d.id.val

EOF

DATASET_ID=`python new_dataset.py --name newdataset-$$`
echo "My Dataset: $DATASET_ID"



Let us know how that goes.

Cheers,
~Josh.