Using external libraries/software

Hi, apologies if this is covered somewhere, or I missed this in the examples in Github!

For the recipe that @dlynch is building, we will at some point need to process data either with Paraview or a VTK library/package.

Which of these would be the best way to approach this? I assume the second? :slight_smile:

Hi @adammer, I’m working on the document for writing Recipes and sorry that it’s taking longer than expected.

The short answer is that each command runs inside a [Docker] container and as long as you can create an image for the library you can execute it on Pollination. In your case you can use VTK or ParaView’s Docker image. The place to set up the image is the Plugin.

Here is the longer answer:

A Recipe is a collection of DAGs and a DAG is a collection of tasks. Each task uses a Function as a template. And each Function is part of a Plugin. When you execute a command - it technically get’s executed inside the Function and the Function uses Plugin's [Docker] image to execute the task!

This means you need to create a Plugin with those Functions and use the Paraview or VTK docker image for that plugin.

I know that I introduced so many concepts in two paragraphs. Let’s use honeybee-energy as an example. It’s a plugin that includes several functions for energy simulation Recipes. Here is the repository:

If you check the __init__.py file you will see that the image for this plugin is set to ladybugtools/honeybee-energy.


# this is a facny way to get the version for the docker image
# the results is something like ladybugtools/honeybee-energy:1.69.2
image_id = get_docker_image_from_dependency(
    __package__, 'honeybee-energy', 'ladybugtools'
)


__pollination__ = {
    'config': {
        'docker': {
            'image': image_id,
            'workdir': '/home/ladybugbot/run'
        }
    }
}

This is also reflected on the plugin page on Pollination.

Perfect! I should have checked more recipes :slight_smile:

That should work, then.

1 Like

Not your fault! We should have a better documentation. I’m half way there. We were not expecting someone to be so brave to want to write a recipe right away! :grinning_face_with_smiling_eyes: Thank you for being patient with us. Getting there …