Scenario Library - k-p2p-lab/kpl-v3 GitHub Wiki

Scenario Library

Wiki home

Documentation index · Source repository

The Dashboard stores reusable, validated YAML scenarios on the Controller. Library records are independent of experiment results: saving a scenario does not run it, running edited YAML does not save it automatically, and deleting either record does not delete the other.

Use the library in the Dashboard

  1. Open Run experiment. The Saved scenarios list is loaded from the current Controller.
  2. Choose + New, enter a descriptive Saved scenario name, and edit the YAML.
  3. Choose Save scenario. The saved item becomes the selected record.
  4. Click a saved scenario’s name (Load →) to replace the name and YAML in the editor. The selected item is highlighted with Editing.
  5. Edit either the name or YAML and choose Save changes to update the selected record. Choose Save as new to keep the original and create another record.
  6. Choose the trash icon, then Confirm delete, to remove a record; Cancel keeps it. The refresh icon reloads the list from the Controller.

To add files from your device, use Choose files in the Scenario editor header. On mobile, open + New or Editor first. Select UTF-8 .yaml or .yml files, each up to 1 MiB, with at most 100 files and 16 MiB in one selection. Saved names use the filename without its last extension: mesh.er.yaml becomes mesh.er. The YAML's top-level name stays unchanged.

  • One file: its contents become a new unsaved draft. Review the name and YAML, use Validate, then choose Save scenario.
  • Multiple files: a review list shows each saved name and status while preserving the current editor draft. Uncheck files to exclude them, then choose Import selected to validate and save the selected files sequentially. Empty, unreadable, invalid UTF-8, oversized files, and duplicate saved names within the selection are identified separately. Cancel or Done returns to the retained draft.

File selection alone does not save or run scenarios. During an import, Stop after current finishes the current request and leaves the remaining files in the review. Closing the editor during saving has the same effect; reopening retains the review and acknowledged saves. Closing during the initial device read cancels that read without changing the draft. Already saved files are excluded from retries. If only group assignment fails, Import selected retries that assignment without creating another scenario. A Status unknown row means the server may have saved the file; it stops the queue and cannot be retried from that review. Leave the review, refresh the saved list, and check for the scenario before selecting that file again.

On desktop, the library and editor appear side by side. On mobile, switch between Saved scenarios and Editor; loading an item opens the editor without automatically opening the keyboard. The run controls remain visible below either view. Search by name or ID to filter the library while preserving the current editor contents and most-recent-first order. The summary shows how many items match; clear the search to restore the full list.

New resets the editor to the built-in example and clears the selected record. Loading another item, choosing one file, or starting a new one replaces unsaved editor changes without a recovery copy. Multiple-file review preserves the draft and hides the editor heading and run controls to give the file list more space. Cancel or Done restores them. The Run button executes the YAML currently in the editor and can run it 1–100 times whether it has been saved or not.

Names are trimmed, required, limited to 128 Unicode characters, and cannot contain control characters. YAML is required, limited to 1 MiB, and must pass normal scenario validation before it is stored. Names do not have to be unique; each record receives its own generated ID. The list is ordered by most recent update.

The library name and YAML's top-level name are independent: the former labels the saved editor input, while the latter names experiment runs. Saving validates the scenario schema; it does not reserve Agent capacity or test Docker, kernel support, or connectivity.

Download selected scenarios

In Saved scenarios, choose Select, check the desired items, and choose Download ZIP. Select visible selects the current group/search matches. The ZIP contains one <saved scenario name>.yaml per selected record, with its stored YAML unchanged. Unsaved editor changes are excluded. Filenames preserve Unicode, replace unsafe characters, shorten long names, and add numeric suffixes when names collide. Extract the YAML files to import them with Choose files; group membership is not part of the YAML export.

Preparation and download limits are defined in the bulk download API.

Shared groups

Saved scenarios and Saved results use the same groups. The Group filter is shared between these views in the current page: choosing a group in one view also filters the other. All groups shows every group; Ungrouped shows items without a group. Search and result status filters further narrow the displayed items.

  1. Open Groups, enter a name, and choose Create. Use a group's Edit button to rename it or choose Delete group and confirm.
  2. In either list, choose Select to show selection checkboxes. Select individual items or use Select visible, which respects the current group, search, and result status filters.
  3. Choose the destination and Move. Choose Ungrouped to remove group membership. Clear clears the selection; Done leaves selection mode.

Each saved scenario or result set belongs to at most one group. A repeated experiment's entire batch is one result set, including previous attempts, retries and later added runs; a standalone run is one result set. Moving a batch keeps these runs together. Delete group removes the group and leaves its saved scenarios and results available under Ungrouped. The separate Delete batch result action deletes the batch's saved results after confirmation.

New scenario saves, including Save as new, use the group selected when saving starts. Multiple-file import captures that group when the review opens and displays it above the list, so a later filter change does not redirect the import. All groups and Ungrouped create ungrouped scenarios. Saving changes to an existing scenario retains its membership.

Running a selected saved scenario automatically places its new results in that scenario's current group on the server. This also applies when the editor contains unsaved changes: Run executes the editor YAML and uses the selected saved item only to find its group. Both a single run and all repetitions inherit the group when the new submission is accepted. An ungrouped saved scenario or a new unsaved input produces Ungrouped results, regardless of the active filter. After acceptance, the Dashboard refreshes group membership so the results appear in the matching group.

Moving or deleting the source scenario later leaves existing results in their own group. Results moved with Select → Move keep that choice across retries, resumes and added runs. Those operations retain the existing result group's membership. Group lookup or persistence errors prevent a new submission from starting; resolve the reported error and submit again.

Groups and memberships are shared with other viewers and survive Controller restarts in local <data-dir>/library-groups.json. Include this file in Controller backups. Use the list refresh or Groups → Refresh to fetch changes from another browser. Concurrent updates report a conflict and reload the current groups before another attempt; an uncertain write requires a refresh. Group names, limits and API contracts are defined by the shared library groups API.

Validate editor contents

Click Validate beside YAML scenario to check the current text with the same parser used for saving and running. The panel below the editor shows success with the scenario name and phase count, or the reason validation failed. YAML diagnostics include line numbers when available; configuration errors identify the relevant field or phase. Long errors can be scrolled and copied.

Validation reuses the login session, requires no saved scenario name, and does not save or start anything. YAML must contain a single document and fit within 1 MiB. Editing the YAML, choosing New or one file, or loading another scenario clears the previous result; late responses for older text are ignored. Multiple-file review preserves the existing draft and its validation state. Request/network failures are distinguished from invalid YAML. A successful check does not test Agent capacity, Docker support, or runtime connectivity.

Estimated finish times

See execution time estimates for live progress forecasts and their uncertainty.

REST API

Request bodies, responses, limits, and curl examples are in the scenario library API.

Storage and backup

Records are stored as individual JSON files under <data-dir>/scenarios. Swarm mounts the Controller's persistent data volume at /var/lib/kpl/data, so ordinary service restarts and scripts/swarm.sh remove preserve the library. Back up the entire Controller data directory to keep both the scenario library and experiment results. The library is local to that Controller and is not replicated between control nodes.

The Controller writes each record through a temporary file and atomic filesystem operation. It rejects malformed or unexpected record content when listing or loading the library rather than returning a partially trusted scenario.

Storage, payload limits, and validation are implemented in internal/controller/scenarios.go; the editor workflow is in internal/webui/static/app.js.


Korean translation: 한국어.

⚠️ **GitHub.com Fallback** ⚠️