Programmatic dataset imports

Hey guys, question about datasets imports. I was extremely happy using

from renku.core.commands import dataset

...

dataset.import_dataset(uri=link, commit_message=message)

kind of things, to programmatically import several datasets as provided by a list, and was working fine on renku 0.12.3 I updated it to 0.13.0 and now things have changed and i no longer can do the same. That is fine, but made me wonder if there is some agreed way of importing datasets form lists programatically using python? or is something that is bound to evolve again substantially?

I pin the renku version from now on, but I suspect that is not really a maintainable solution and I should stick to fresher software, I guess…

Thanks a ton for any pointer, all the best guys!

Hi Michele,

There were some changes in the way we call renku command functions. To do the same thing as before:

from renku.core.commands.dataset import import_dataset
from renku.cli.utils.callback import StandardOutput

import_dataset().with_communicator(StandardOutput()).with_commit_message(message).build().execute(uri=link, yes=True)

Depending on where you run this, you might not see console messages. This call returns a renku.core.incubation.command.CommandResult object that you can check to see its output. If there is an error then an exception is raised.

On a different note, we’ve added a renku API that provides an easier way to work with renku repos. ATM it does not do much (and doesn’t support dataset import) but you still can see the basic idea behind it: Renku Python API — Renku 0.13.1.dev16 documentation.

Cheers,
Mohammad