Monitor Dashboard

The Asgard monitor is a web-based dashboard for viewing simulation runs and their results. It provides interactive visualizations with real-time updates as new results are saved.

Starting the Monitor

# Start with default settings (port 8000, storage in ./storage)
uv run asgard monitor

# Custom storage directory and port
uv run asgard monitor --storage ./my-results --port 8080

Open http://localhost:8000 in your browser to view the dashboard.

Running Examples with the Monitor

The --monitor flag starts the monitor alongside example execution, so results appear in real time:

# Run a single example with monitor
uv run asgard example basic/01_integration.yaml --monitor

# Run a category of examples with monitor
uv run asgard example -c stochastic --monitor

What the Monitor Shows

Run List

The main page lists all simulation runs with:

Result Detail

Clicking a run shows its results, rendered with type-specific visualizations:

Result Type Visualization
Solution1D Line plot with computed vs expected curves
Solution2D Interactive heatmap
StochasticEnsemble Ensemble paths with mean, confidence bands, and distribution histograms
DiscreteSequence Discrete step plot
OptimizationResult Loss curve and parameter evolution
PhysicsAnimation Animated visualization frames

Real-Time Updates

The monitor uses Server-Sent Events (SSE) to update the dashboard automatically when new results are saved. No need to refresh the page.

Storage

Directory Structure

Results are stored in a directory (default: ./storage):

storage/
├── .asgard_metadata.json     # Storage metadata
├── runs/
│   └── {run-uuid}.json       # Run metadata + result references
├── results/
│   └── {result-uuid}.json    # Result data + display config
└── files/
    └── {result-uuid}_*.npy   # Large arrays stored separately

The --storage Flag

Control where results are stored:

# Specify storage directory
uv run asgard monitor --storage /path/to/results

# Examples also respect storage
uv run asgard example -c basic --monitor --storage ./experiment-results

Storage in Python

Results can be saved and loaded programmatically:

from gimle.asgard.monitor.storage import AsgardStorage

# Open or create storage
storage = AsgardStorage("./my-results")

# Create a run
run = storage.create_run(name="My Simulation", equation="int(f, x) = g")

# Add a result
storage.add_result(
    run_id=run.id,
    result_type="Solution1D",
    data={"x": x_values, "computed": y_values},
    display={"title": "My Plot", "labels": {"x": "x", "y": "f(x)"}}
)

# List runs
runs = storage.list_runs()

# Load a run with results
run = storage.get_run(run_id)

Large arrays (numpy/JAX) are automatically saved as separate .npy files to keep JSON files small.

API Endpoints

The monitor exposes a REST API for programmatic access:

Endpoint Method Description
/api/runs GET List all runs (cached for 3s)
/api/run?id={id} GET Get run with rendered results
/api/run?id={id} DELETE Delete a run and its results
/api/result?id={id} GET Get a single result detail
/api/updates GET SSE stream for real-time updates

Next Steps