Skip to main content

Developer quick reference


⚠️ This is a quick-reference guide, not a complete guide to making a plugin. Use this to copy-paste commands while working on plugins and to troubleshoot them in the testing and scheduling stages. Please consult the official πŸ“—Plugin Tutorials for detailed guidance.


ℹ️ Plugin=App

πŸ“— = recommended code docs and tutorials from Sage.

πŸ‘‰ First make a minimalistic app with a core functionality to test on the node. Later you may add all the options you want.

☝️ Avoid making a plugin from scratch. Use another plugin or this template for your first plugin or use πŸ†• Cookiecutter Template.

⚠️ Repository names should be all in small alphanumeric letters and -.

Requirements : Install Docker, git, and Python

Components of a plugin​

Typical components of a Sage plugin are described below:

1. An application​

This is just your usual Python program, either a single .py script or a set of directories with many components (e.g. ML models, unit tests, test data, etc).

πŸ‘‰ First do this step on your machine and perfect it until you are happy with the core functionality.

app/* : the main Python file (sometimes also named contains the code that defines the functionality of the plugin or calls other scripts to do tasks. It usually has from waggle.plugin import Plugin call to get the data from in-built sensors and publishes the output.

Note: Variable names in plugin.publish should be descriptive and specific.

Install pywaggle pip3 install -U 'pywaggle[all]'

app/ : optional but recommended file, contains the unit tests for the plugin.

2. Dockerizing the app​

πŸ‘‰ Put everything in a Docker container using a waggle base image and make it work. This may require some work if libraries are not compatible. Always use the latest base images from Dockerhub

Dockerfile* : contains instructions for building a Docker image for the plugin. It specifies the waggle base image from dockerhub, sets up the environment, installs dependencies, and sets the entrypoint for the container.

⚠️ Keep it simple ENTRYPOINT ["python3", "/app/"]

requirements.txt* : lists the Python dependencies for the plugin. It is used by the Dockerfile to install the required packages using pip. : is an optional shell script to automate building the complicated Docker image with tags etc.

Makefile : optional but the recommended file includes commands for building the Docker image, running tests, and deploying the plugin.

3. ECR configs and docs​

You can do this step (except sage.yaml) after testing on the node but before the ERC submission. πŸ˜„

sage.yaml* : is the configuration file useful for ECR and job submission? Most importantly it specifies the version and input arguments. and ecr-meta/* : a Markdown file describing the scientific rationale of the plugin as an extended abstract. This includes a description of the plugin, installation instructions, usage examples, data downloading code snippets, and other relevant information.

πŸ’‘ Keep the same text in both files and follow the template of

ecr-meta/ecr-icon.jpg : is an icon for the plugin in the Sage portal.

ecr-meta/ecr-science-image.jpg : is a key image or figure plot that best represents the scientific output of the plugin.


πŸ“— Check Sage Tuorial Part1 and Part2

Getting access to the node​

  1. Follow this page: to access the nodes.
  2. To test your connection the first time, execute ssh waggle-dev-sshd and enter your ssh key passphrase. You should get the following output,

Enter passphrase for key /Users/bhupendra/.ssh/id_rsa: no command provided Connection to closed.

Enter the passphrase to continue.

  1. To connect to the node, execute ssh waggle-dev-node-V032 and enter your passphrase (required twice).

You should see the following message,

We are connecting you to node V032


πŸ“— See Sage Tuorial: Part 3 for details on this topic.

Testing plugins on the nodes​


⚠️ Do not run any app or install packages directly on the node. Use Docker container or pluginctl commands.

1. Download and run it​


  • If you have not already done it, you need your plugin in a public GitHub repository at this stage.
  • To test the app on a node, go to nodes W0xx (e.g. W023) and clone your repo there using the command git clone.
  • At this stage, you can play with your plugin in the docker container until you are happy. Then if there are changes made to the plugin, I reccomend replicating the same in your local repository and pushing it to the github and node.
  • or do git commit -am 'changes from node' and git push -u origin main.
  • However, before commiting from node, you must run following commands at least once in your git repository on the node. git config [--locale] "Full Name"git config [--locale] ""

⚠️ Make sure your Dockerfile has a proper entrypoint or the pluginctl run will fail.

Testing with Pluginctl​


πŸ“— For more details on this topic check pluginctl docs.

  1. Then to test execute the command sudo pluginctl build .. This will output the plugin-image registry address at the end of the build. Example:
  2. To run the plugin without input argument, use sudo pluginctl run -n <some-unique-name> <1x.xx.xx.x:5000/local/my-plugin-name>
  3. Execute the command with input arguments. sudo pluginctl run -n <some-unique-name> <1x.xx.xx.x:5000/local/my-plugin-name> -- -i top_camera.
  4. IF you need GPU, use the selector sudo pluginctl run -n <some-unique-name> <1x.xx.xx.x:5000/local/my-plugin-name> -- -i top_camera.
  5. ❗ -- is a separator. After the -- all arguments are for your entrypoint i.e.
  6. To check running plugins, execute sudo pluginctl ps. To stop the plugin, execute sudo pluginctl rm cloud-motion. ⚠️Do not forget to stop the plugins after testing or it will run forever.

Testing USBSerial devices​

πŸ‘‰The USBserial device template is in Cookiecutter Template. Also check wxt536 plugin.

Steps for working with a USB serial device

  1. First, you need to confirm which computing unit the USB device is connected to, RPi or nxcore.
  2. Then, you add the --selector and --privileged options to the pluginctl command during testing and specifying the same in the job.yaml for scheduling.
  3. To test the plugin on nxcore, which has the USB device, use the command sudo pluginctl run -n testname --selector zone=core --privileged
  4. The --selector and --privileged attributes should be added to the pluginSpec in the job submission script as shown in the example YAML code.
  5. You can check which computing unit is being used by the edge scheduler by running the kubectl describe pod command and checking the output.

⚠️ Re/Check that you are using the correct USB port for the device if getting empty output or folder not found error.

2. Check if it worked​

Login to the Sage portal and follow the instructions from the section See Your Data on Sage Portal

3. Troubleshooting failed plugin​

When you encounter a failing/long pending job with an error, you can use the following steps to help you diagnose the issue:

  1. First check the Dockerfile entrypoint.
  2. Use the command sudo kubectl get pod to get the name of the pod associated with the failing job.
  3. Use the command sudo kubectl logs <<POD_NAME>> to display the logs for the pod associated with the failing job. These logs will provide you with information on why the job failed.
  4. Use the command sudo kubectl describe pod POD_NAME to display detailed information about the pod associated with the failing job.
  5. This information can help you identify any issues with the pod itself, such as issues with its configuration or resources.

By following these steps, you can better understand why the job is failing and take steps to resolve the issue.

Edge Code Repository​

How to get your plugin on ECR​

To publish your Plugin on ECR, follow these steps:

  1. Go to
  2. Click on "Explore the Apps Portal".
  3. Click on "My Apps". You must be logged in to continue.
  4. Click "Create App" and enter your Github Repo URL.
  5. 'Click "Register and Build App".
  6. On Your app page click on the "Tags" tab to get the registry link when you need to run the job on the node either using pluginctl or job script. This will look like:docker pull
  7. Repeat the above process for updating the plugin.

After the build process is complete, you need to make the plugin public to schedule it.

πŸ‘‰ If you have skipped step 3. ECR Configs and Docs, do it before submitting it to the ECR. Ensure that your ecr-meta/ and sage.yaml files are properly configured for this process.

Versioning your code​


You can not resubmit the plugin to ECR with the same version number again.

  • So think about how you change it every time you resubmit to ERC and make your style of versioning. πŸ€”
  • I use 'vx.y.m.d' e.g. 'v0.23.3.4' but then I can only have 1 version a day, so now I am thinking of adding an incremental integer to it.

After ECR registry test (generally not required)​

  1. Generally successfully tested plugins just work. However, in case they are failing in the scheduled jobs after running for a while or after successfully running in the above tests, do the following.
  2. To test a plugin on a node after it has been built on the ECR, follow these steps: sudo pluginctl run --name test-run -- -input top
  3. This command will execute the plugin with the specified ECR image (version, passing the "-input top" argument to the plugin (Note -- after the image telling pluginctl that these arguments are for the plugin).

πŸ‘‰ Note the use of sudo in all pluginctl and docker commands on the node.

Assuming that the plugin has been installed correctly and the ECR image is available, running this command should test the "test-motion" plugin on the node.

You may also have to call the kubectl <POD> commands as in the testing section if this fails.

Scheduling the job​


❗ If you get an error like registry does not exist in ECR, then check that your plugin is made public.

  • Follow this link to get an understanding of how to submit a job
  • Here are the parameters we set for the Mobotix sampler plugin,
-name thermalimaging \
--ip \
-u userid \
-p password \
--frames 1 \
--timeout 5 \
--loopsleep 60
  • Your science rule can be a cronjob (More information can be found here
  • This runs every 15 minutes "thermalimaging": cronjob("thermalimaging", "*/15 * * * *").
  • Use Crontab Guru.
  • You can also make it triggered by a value. Please read this for supported functions.

Scheduling scripts​

✨ Check user friendly job submission UI.

πŸ“— Check sesctl docs for command line tool.

  1. ☝️ Do not use capital letters/dots in the job name.
  2. ☝️ make the plugin public in the Sage app portal.

job.yaml example for USB device​

name: atmoswxt
- name: waggle-wxt536
privileged: true
zone: core
nodeTags: []
W057: true
W039: true
- 'schedule("waggle-wxt536"): cronjob("waggle-wxt536", "1/10 * * * *")'
- WallClock('1day')

Multiple jobs example​

If you want to run your plugins not all at the same time. Use this example.

name: w030-k3s-upgrade-test
- name: object-counter-bottom
- -stream
- bottom_camera
- -all-objects
resource.gpu: "true"
- name: cloud-cover-bottom
- -stream
- bottom_camera
resource.gpu: "true"
- name: surfacewater-classifier
- -stream
- bottom_camera
- -model
- /app/model.pth
- name: avian-diversity-monitoring
- --num_rec
- "1"
- --silence_int
- "1"
- --sound_int
- "20"
- name: cloud-motion-v1
- --input
- bottom_camera
- name: imagesampler-bottom
- -stream
- bottom_camera
- name: audio-sampler
nodeTags: []
W030: true
- 'schedule(object-counter-bottom): cronjob("object-counter-bottom", "*/5 * * * *")'
- 'schedule(cloud-cover-bottom): cronjob("cloud-cover-bottom", "01-59/5 * * * *")'
- 'schedule(surfacewater-classifier): cronjob("surfacewater-classifier", "02-59/5
* * * *")'
- 'schedule("avian-diversity-monitoring"): cronjob("avian-diversity-monitoring", "*
* * * *")'
- 'schedule("cloud-motion-v1"): cronjob("cloud-motion-v1", "03-59/5 * * * *")'
- 'schedule(imagesampler-bottom): cronjob("imagesampler-bottom", "04-59/5 * * * *")'
- 'schedule(audio-sampler): cronjob("audio-sampler", "*/5 * * * *")'
- Walltime(1day)

here objecct-counter runs at 0, 5, 10, etc cloud-cover: 1, 6, 11, etc. surface water: 2, 7, 12, etc. cloud-motion: 3, 8, 13, etc. image-sampl: 4, 9, 14, etc.

Debugging failed jobs​

Do you know how to identify why a job is failing

  1. ✨ When the job failures are seen as red markers on your job page, you can click them to see the error. click on red markers

  1. Or detail errors can be found using using sage_data_client
  • Requirements: sage_data_client and
  • By specifying the plugin name and node, the following code will print out the reasons for job failure within the last 60 minutes.
from utils import *

mynode = "w030"

myplugin = "water"
df = fill_completion_failure(parse_events(get_data(mynode, start="-60m")))
for _, p in df[df["plugin_name"].str.contains(myplugin)].iterrows():

Downloading the data​

Sage docs for accessing-data

See Your Data on Sage Portal​

To check your data on Sage Portal, follow these steps:

  1. Click on the Data tab at the top of the portal page.
  2. Select Data Query Browser from the dropdown menu.
  3. Then, select your app in the filter. This will show all the data that is uploaded by your app using the plugin.publish() and plugin.upload() methods.

In addition, you can data visualize as a time series and select multiple variables to visualize together in a chart, which can be useful for identifying trends or patterns.

Download all images with wget​

  1. Visit
  2. select the node and period for data.
  3. Select the required data and download the text file urls-xxxxxxx.txt with urls
  4. To select only the top camera images, use the vim command: g/^\(.*top\)\@!.*$/d. This will delete URLs that do not contain the word 'top'
  5. Copy the following command from the website and run it in your terminal. wget -r -N -i urls-xxxxxxx.txt

Sage data client for text data​


πŸ“— Documentation for accessing the data.

Querying data example​

The sage_data_client provides query() function which takes the parameters:

start: The start time of the query as a string. end: The end time of the query as a string. filter: A dictionary with key-value pairs to apply filter. The function returns a Pandas DataFrame object. Check more examples.

import sage_data_client
import urllib
import tempfile
from IPython.display import Image
import imageio as io
import os

from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw

df = sage_data_client.query(
"plugin": "*",
"vsn": "W084",
"job": "imagesampler-top"

with io.get_writer('taft.mp4', fps=5) as writer:
for i in df.index:
uurl = df.value[i]
timestamp = df.timestamp[i]
tempf = tempfile.NamedTemporaryFile()

img =
draw = ImageDraw.Draw(img)
font = ImageFont.truetype("SFNS.ttf", 64)
draw.text((800, 1800),timestamp.strftime('TAFT Waggle Node 84 %y-%m-%d %H:%M Z'),(255,255,255),font=font) + '.jpg')

image = io.imread( + '.jpg')
except urllib.error.HTTPError:
print('Image skipped ' + uurl)


More data analysis resources​


Find PT Mobotix thermal camera ip on the node​

Login to the node where the PTmobotix camera is connected.

  1. run nmap -sP
Nmap scan report for ws-nxcore-000048B02D3AF49F (
Host is up (0.0012s latency).
Nmap scan report for switch (
Host is up (0.0058s latency).
Nmap scan report for ws-rpi (
Host is up (0.00081s latency).
Nmap scan report for
Host is up (0.0010s latency).
Nmap scan report for
Host is up (0.00092s latency).
Nmap scan report for
Host is up (0.0014s latency).
Nmap done: 256 IP addresses (6 hosts up) scanned in 2.42 seconds
  1. From the output run following command for each cam_IPcurl -u admin:wagglesage -X POST http://cam_IP/control/rcontrol?action=putrs232&rs232outtext=%FF%01%00%0F%00%00%10

e.g. curl -u admin:wagglesage -X POST

  1. The ip for which output is OK is the Mobotix.