Skip to content

Commit

Permalink
Merge dd523ef into 007c2fa
Browse files Browse the repository at this point in the history
  • Loading branch information
tymokvo committed Feb 12, 2021
2 parents 007c2fa + dd523ef commit d537fbd
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions docs/guides/plugin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Create A New Plugin
In this section we will walk you through how to create a new plugin from an existing Command Line Interface (CLI) tool. We will create a folder to save our
plugin definition, write the plugin package metadata and define a few functions exposed by the plugin.

We will be creating a plugin that uses EnergyPlus. This Plugin will transform commands provided in the `examples <https://github.com/NREL/EnergyPlus/blob/370d5b8f4d8a27a80d9b6ed21b1fa7a989f75dc1/doc/running-energyplus-from-command-line.md#examples>`_
We will be creating a plugin that uses EnergyPlus. This Plugin will transform commands provided in the `examples <https://github.com/NREL/EnergyPlus/blob/370d5b8f4d8a27a80d9b6ed21b1fa7a989f75dc1/doc/running-energyplus-from-command-line.md#examples>`_
section of the CLI documentation into Queenbee Plugin Functions.

Getting Started
Expand Down Expand Up @@ -35,6 +35,9 @@ Configuration
The ``config.yaml`` file contains information to indicate what underlying software should execute
the plugin's functions. We will be focusing on the ``docker`` configuration.

If you are unfamiliar with ``docker``, you can refer to the introduction
here <https://www.docker.com/resources/what-container>.

You can check the full schema definition for a plugin Config `here <../_static/redoc-plugin.html#tag/config_model>`_

Docker Config
Expand All @@ -56,8 +59,9 @@ The container image documentation explains that::

> docker run -it --rm -v $(pwd):/var/simdata nrel/energyplus EnergyPlus

This means that when the Docker container is run, the command is run from the ``/var/simdata`` directory. This
is what we call the Working Directory or ``wordir`` for short.
This means that when the Docker container is run, the daemon will mount the
current directory into the container's ``/var/simdata`` directory. This
is also the container's Working Directory or ``workdir`` for short.

Overwrite the contents of the ``config.yaml`` file with the YAML code block below:

Expand All @@ -77,7 +81,7 @@ The file currently contains name and version information:
name: energy-plus
version: 0.1.0
These are the two mandatory fields for this file. You can view a full list of other available
These are the two mandatory fields for this file. You can view a full list of other available
fields `here <../_static/redoc-plugin.html#tag/metadata_model>`_.

We will be adding a few more fields for demonstration purposes. Overwrite the contents of
Expand All @@ -90,11 +94,10 @@ We will be adding a few more fields for demonstration purposes. Overwrite the co
Your First Function
-------------------
We are now finally ready to write a Function. Functions are the key ingredients of a plugin. A Function
defines a parametrized command run in a terminal. You can refer to the
defines a parameterized command run in a terminal. You can refer to the
`function schema definition <../_static/redoc-plugin.html#tag/function_model>`_ to understand the components of a function.


We listed some function we wanted to create based on examples provided by the EneryPlus documentation.
We listed some function we wanted to create based on examples provided by the EneryPlus documentation.

We will start by creating a function that takes a weather file and an ``idf`` file as inputs, runs an energyplus simulation
and outputs a folder with all the EnergyPlus output files. Delete the ``say-hi.yaml`` file in your ``functions`` folder.
Expand All @@ -108,6 +111,9 @@ Now create a new file called ``run-simulation.yaml`` in the ``functions`` folder
.. literalinclude:: ../../tests/assets/plugins/folders/energy-plus/functions/run-simulation.yaml
:language: yaml

The paths of the files that are referenced in the ``inputs`` block will be
interpreted relative to the ``workdir`` of the container used to execute the
function.

Your folder should now look something like this::

Expand All @@ -130,7 +136,7 @@ directory. This is a packaged Plugin file which can be saved in a Queenbee
Repository to share with others or be used in a Recipe.

You should go to the `Repository Guide <repository.html>`_ section to understand
how Plugins are packaged and shared.
how Plugins are packaged and shared.


Using Plugins
Expand Down

0 comments on commit d537fbd

Please sign in to comment.