DEW — Distributed Experiment Workflow
DEW is a lightweight coordination layer for multi-node testbed experiments. A small per-node agent plus a shared RabbitMQ event bus let you run commands in order across machines — "node A does X, and only once A announces it is done does node B do Y" — with no central scheduler. It fills the gap plain install/automation tools (Ansible, per-node config) leave open: cross-node runtime ordering.
It runs on the SPHERE testbed. An XDC drives a run; the agent runs on each experiment node; one node hosts the broker.
New here? USER_GUIDE.md is a step-by-step walk-through of every feature;
docs/dew-on-sphere.md is the self-contained reference for SPHERE users;
sphere/FILES.md explains what each file does.
docs/dew-on-sphere.md is written for the SPHERE documentation site
(https://gitlab.com/mergetb/testbeds/sphere/documentation, Docusaurus), where it lives as
docs/Experimentation/dew.md; merging it to that repo's main also updates the SPHERE chatbot.
Edit it here first, then copy it over in a merge request.
Licensed under the BSD 3-Clause License; see LICENSE.
Layout
All functional code lives in sphere/:
| File | Runs on | Purpose |
|---|---|---|
schedulejob.py |
each node | the agent — parses a scenario, runs its tasks, coordinates via events |
primitives.py |
node + XDC | resolves $nid, $IP(A), $expeth(A), … in bindings |
run.py |
XDC | publishes a run; --follow watches it live |
stop.py |
XDC | stops a run |
dewctl |
XDC | front end: deploy / run / stop / status / collect / expand |
expand-scenario.py |
XDC | expands role-based scenarios (num N, {role}) into concrete ones |
deploy-dew.sh |
XDC | installs DEW across an experiment in one command (dewctl deploy) |
install-node.sh, install.sh |
node / broker | install helpers, copied to the nodes by dewctl deploy |
install-xdc.sh |
XDC | sets up a venv for running from a git clone (not needed with pip) |
collect-dew.sh |
XDC | pulls result files from many nodes |
createtable.sql |
node | the agent's process-table schema |
cli.py, __init__.py |
XDC | the pip-installed dewctl command, and the version |
tests/ |
anywhere | offline unit tests |
Packaging is in pyproject.toml. Small examples are in examples/;
a fuller set of worked scenarios is at https://github.com/TuetrungNguyen/dewscenarios.
Install
On the XDC, once per user. DEW goes in its own venv (the XDC's Python rejects pip --user); home
directories carry over between XDCs, so this survives making a new one.
DEW is packaged for PyPI as mrg-dew but not published there yet, so for now install it with
pip from a copy of this repository (which needs access to the repository):
git clone https://gitlab.com/glawler/dew.git ~/dew
python3 -m venv ~/dewenv
~/dewenv/bin/pip install ~/dew
echo 'export PATH="$HOME/dewenv/bin:$PATH"' | tee -a ~/.bashrc ~/.profile > /dev/null
export PATH="$HOME/dewenv/bin:$PATH"
dewctl --version
The PATH line goes in both files because the XDC's terminal is a login shell, which reads
~/.profile and not ~/.bashrc; other shells read ~/.bashrc.
The command it installs is dewctl. Once mrg-dew is on PyPI, the clone step goes away and the
install line becomes ~/dewenv/bin/pip install mrg-dew (pin a release with mrg-dew==<version>).
Updating: reinstall, then redeploy so the nodes get the new agent too:
git -C ~/dew pull && ~/dewenv/bin/pip install --force-reinstall --no-deps ~/dew
dewctl deploy all --broker server
Build releases on Linux (e.g. the XDC), never on Windows: a build packs files with their
on-disk line endings, and Windows ones break the node install. PyPI never accepts a version
number twice, so bump __version__ in sphere/__init__.py for every upload.
Quick start
# once per materialization (re-run after an update)
dewctl deploy all --broker server # or: dewctl deploy <nodes> --broker <node>
# per run
dewctl run scenario.json # expands if needed, starts, watches live; Ctrl-C stops the run
dewctl stop
dewctl status
dewctl collect /tmp/result.json
Running straight from the clone (development)
For working on DEW itself, without reinstalling after every edit:
cd ~/dew/sphere
./install-xdc.sh # creates ~/dewenv with pika
./dewctl deploy all --broker server
./dewctl run ../examples/scenario-iperf.json
Scenario format
A scenario is JSON with three sections, plus an optional fourth:
{
"Scenario": { "t1": "server start_web emit up",
"t2": "when up client fetch" },
"Bindings": { "start_web": "bash -c \"...\"",
"up": "started(start_web)",
"fetch": "bash -c \"curl http://server\"" },
"Constraints": {},
"Labels": { "setup": ["t1"], "experiment": ["t2"] }
}
- Scenario — one task per line:
[when <events>] [wait <n>] <node> <action> [emit <event> ...]. Ordering comes only from events:emitannounces one,whenwaits for one,wait <n>delays n seconds after being unblocked. - Bindings — the shell command for each action, and the definition of each event.
- Constraints — role expansion (e.g.
"c1": "client num 5"→client1…client5). - Labels (optional) — named groups of tasks;
dewctl run <file> --only <label>runs just that group, e.g. to re-run the experiment without repeating setup.
Events: emit + a definition
emit is the only event keyword; when an event fires is declared in Bindings as a
function call on the action:
Definition in Bindings |
The event fires when the action… |
|---|---|
success(action) |
exits 0 — the default for a bare emit with no definition |
started(action) |
launches — use for daemons that never exit |
finished(action) |
exits, pass or fail |
failed(action) |
exits non-zero, or cannot launch — route a failure to a recovery task |
A teardown (stop / Ctrl-C) fires none of success/failed/finished.
Primitives
Bindings may use $nid, $eid, $project, $epoch, $expIP, $expeth, $IP(A),
$expIP(A), $expeth(A) — resolved on the node when the scenario is parsed ($epoch at
launch). A bare $ not matching a primitive is left for the shell.
Tests
python3 -m unittest discover sphere/tests
CI and releasing
.gitlab-ci.yml follows GitLab's tutorial
Automatically build and publish packages with CI/CD
(build → test → publish, pip cache, artifacts, pytest, tokens in CI/CD variables, publish only on
a tag), plus DEW-specific checks. On every push:
- build: builds the wheel and sdist,
twine check --strict, and checks the built files have no CRLF line endings; - test: the unit tests with pytest (results appear in the pipeline's Tests tab),
bash -non every script, a source line-ending check, every example indocs/dew-on-sphere.mdthrough DEW's pre-run checks, and the built wheel installed into a clean venv with itsdewctlrun.
The helper scripts are in ci/ and are not part of the package.
To release: bump __version__ in sphere/__init__.py, commit and push, then push a matching
tag:
git tag v0.1.3 && git push origin v0.1.3
The tag's pipeline uploads to TestPyPI automatically (publish-testpypi), then adds a
manual publish-pypi job: check the TestPyPI release, then start it from the pipeline page.
Both refuse a tag that does not match __version__.
One-time setup (repository and PyPI owners):
- Settings → CI/CD → Variables:
PYPI_TOKEN(a pypi.org API token) andTEST_PYPI_TOKEN(a test.pypi.org API token), both masked and protected. - Settings → Repository → Protected tags: protect
v*, so only maintainers can start a release and tag pipelines can read the protected variables.
Requirements
- XDC: Python 3 with
venv; pip installspikaalong with DEW. - Each node: Python 3 and
pika; one node runs a RabbitMQ broker.dewctl deploysets all of this up and writes~/.dewrc(broker host, node list) thatdewctlreads.
Security notes
- Broker login. The broker has one account,
dew/dewby default, used by every agent and bydewctl. It is a shared default, not a secret: the broker runs on one of your experiment nodes, not on a public host. To use a different login, setDEW_RABBITMQ_USER/DEW_RABBITMQ_PASSthe same way for the install and for the agents. - Passwordless sudo.
dewctl deployadds aNOPASSWDsudo rule on each node (/etc/sudoers.d/90-dew), which is how it installs without a prompt per step. It lasts until the node is reimaged; remove that file to undo it.
Metadata
Release files for mrg-dew 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mrg_dew-0.1.3.tar.gz | 44.7 kB | Without provenance | Details for mrg_dew-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mrg_dew-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for mrg_dew-0.1.3-py3-none-any.whl |
Total release size: 95.6 kB
Release files / mrg_dew-0.1.3.tar.gz
| Download URL | mrg_dew-0.1.3.tar.gz |
|---|---|
| Size | 44.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
352b9a4e403715e2bcfdff948272d0e65ac13764a032e6c1a2a6208858550f27
|
|
BLAKE2b-256 checksum How to use checksums |
4c08630ade0219203f2bb1da583ec19a4127bb74315ced43ef5921613bb8f8e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.16
|
Release files / mrg_dew-0.1.3-py3-none-any.whl
| Download URL | mrg_dew-0.1.3-py3-none-any.whl |
|---|---|
| Size | 50.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7404f53bdb57e2a802a8466d384aaa6d6eba414bfdd8c3995d2169a1ee422150
|
|
BLAKE2b-256 checksum How to use checksums |
87a8f13815258558122c2de39205f40910c7b062b9c3192ec5dad52909d5db99
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.16
|
Security for mrg-dew 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.