<h4id="run_plugin"class="doc_header"><code>run_plugin</code><ahref="https://gitlab.memri.io/memri/pymemri/tree/prod/pymemri/plugin/pluginbase.py#L166"class="source_link"style="float:right">[source]</a></h4><blockquote><p><code>run_plugin</code>(<strong><code>pod_full_address</code></strong>:<code>Param object at 0x7f99922dd310></code>=<em><code>None</code></em>, <strong><code>plugin_run_id</code></strong>:<code>Param object at 0x7f99922dd390></code>=<em><code>None</code></em>, <strong><code>database_key</code></strong>:<code>Param object at 0x7f9990eba450></code>=<em><code>None</code></em>, <strong><code>owner_key</code></strong>:<code>Param object at 0x7f9990fb6650></code>=<em><code>None</code></em>, <strong><code>container</code></strong>:<code>Param object at 0x7f998f30a110></code>=<em><code>None</code></em>)</p>
<h4id="run_plugin"class="doc_header"><code>run_plugin</code><ahref="https://gitlab.memri.io/memri/pymemri/tree/prod/pymemri/plugin/pluginbase.py#L166"class="source_link"style="float:right">[source]</a></h4><blockquote><p><code>run_plugin</code>(<strong><code>pod_full_address</code></strong>:<code>Param object at 0x7fe4f89c6340></code>=<em><code>None</code></em>, <strong><code>plugin_run_id</code></strong>:<code>Param object at 0x7fe4f89c63d0></code>=<em><code>None</code></em>, <strong><code>database_key</code></strong>:<code>Param object at 0x7fe4f89c6370></code>=<em><code>None</code></em>, <strong><code>owner_key</code></strong>:<code>Param object at 0x7fe4f03fcd60></code>=<em><code>None</code></em>, <strong><code>container</code></strong>:<code>Param object at 0x7fe4f03fcd30></code>=<em><code>None</code></em>)</p>
<h4id="run_plugin_from_pod"class="doc_header"><code>run_plugin_from_pod</code><ahref="https://gitlab.memri.io/memri/pymemri/tree/prod/pymemri/plugin/pluginbase.py#L198"class="source_link"style="float:right">[source]</a></h4><blockquote><p><code>run_plugin_from_pod</code>(<strong><code>pod_full_address</code></strong>:"The pod full address"=<em><code>None</code></em>, <strong><code>database_key</code></strong>:"Database key of the pod"=<em><code>None</code></em>, <strong><code>owner_key</code></strong>:"Owner key of the pod"=<em><code>None</code></em>, <strong><code>container</code></strong>:"Pod container to run frod"=<em><code>None</code></em>, <strong><code>plugin_module</code></strong>:"Plugin module"=<em><code>None</code></em>, <strong><code>plugin_name</code></strong>:"Plugin class name"=<em><code>None</code></em>)</p>
<h4id="run_plugin_from_pod"class="doc_header"><code>run_plugin_from_pod</code><ahref="https://gitlab.memri.io/memri/pymemri/tree/prod/pymemri/plugin/pluginbase.py#L198"class="source_link"style="float:right">[source]</a></h4><blockquote><p><code>run_plugin_from_pod</code>(<strong><code>pod_full_address</code></strong>:"The pod full address"=<em><code>None</code></em>, <strong><code>database_key</code></strong>:"Database key of the pod"=<em><code>None</code></em>, <strong><code>owner_key</code></strong>:"Owner key of the pod"=<em><code>None</code></em>, <strong><code>container</code></strong>:"Pod container to run frod"=<em><code>None</code></em>, <strong><code>plugin_module</code></strong>:"Plugin module"=<em><code>None</code></em>, <strong><code>plugin_name</code></strong>:"Plugin class name"=<em><code>None</code></em>, <strong><code>settings_file</code></strong>:"Plugin settings (json)"=<em><code>None</code></em>)</p>
The memri [pod](https://gitlab.memri.io/memri/pod) uses a plugin system to add features to the backend memri backend. Plugins, can import your data (importers), change your data (indexers), or call other serivces. Users can define their own plugins to add new behaviour to their memri app. Let's use the following plugin as an example of how we can start plugins.
Memri plugins need to define at least 2 methods: `.run()` and `.add_to_schema()`. `.run()` defines the logic of the plugin. `.add_to_schema()` defines the schema for the plugin in the pod. Note that currently, `add_to_schema` requires all item to **have all properties defined that are used in the plugin**. In the future, we might replace add_to_schema, to be done automatically, based on a declarative schema defined in the plugin.
Plugins can be started using the pymemri `run_plugin` CLI. To use the CLI, you can either pass your run arguments as parameters, or set them as environment variables. If both are set, the CLI will prefer the passed arguments.
print(f"\ncalling the `create` api on {pod_full_address} to make your Pod start "
f"a plugin with id {run.id}.")
print(f"*Check the pod log/console for debug output.*")
client.create(run)
```
%% Cell type:markdown id: tags:
In production, we start plugins by making an API call to the pod, which in turn creates an environment for the plugin and starts it (currently on docker is supported). We can start this process using the CLI by provding `--from_pod==True` and providing a `--container` (the docker container used by the pod). **Note that the provided docker container should be installed within the Pod environemnt (e.g. `docker build -t pymemri .` for this repo) in order to start it.**