Skip to content

Commit c5e186a

Browse files
committed
Update of the fastmon-client, intended to work receiving SSE messages
1 parent da6f7a2 commit c5e186a

File tree

5 files changed

+216
-112
lines changed

5 files changed

+216
-112
lines changed

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,14 @@ The agent operates as a managed service within the swf-testbed ecosystem, automa
2828
# The agent runs as a managed service within the testbed
2929
cd $SWF_PARENT_DIR/swf-testbed
3030
swf-testbed status # Check if fast monitoring agent is running
31+
```
32+
33+
The agent relies on `.env` configuration for API tokens and monitor URLs, and uses supervisord for process management.
3134

32-
# Manual development run (message-driven mode - default)
35+
### Manual execution for development/testing
36+
37+
```bash
38+
# For manual development run (message-driven mode - default)
3339
cd ../swf-fastmon-agent
3440
export SWF_MONITOR_HTTP_URL="http://localhost:8002"
3541
export SWF_API_TOKEN="your_api_token_here"
@@ -63,20 +69,17 @@ The fast monitoring agent is configured through the swf-testbed ecosystem:
6369
- **Message-driven mode**: Responds to data_ready messages from swf-data-agent
6470
- **Continuous mode**: Periodically scans directories (for development/testing)
6571
- **Status Reporting**: Provides health checks and performance metrics via BaseAgent
66-
- **Token-based Authentication**: Secure API access using token authentication
6772

68-
### Fast Monitoring Client
73+
### Fast Monitoring Client (in development)
6974
- **Real-time Display**: Receives and displays TF file notifications in terminal via SSE streaming
7075
- **Statistics Tracking**: Monitors per-run TF counts and data volume
7176
- **Graceful Shutdown**: Handles Ctrl+C with summary statistics
72-
- **Message Filtering**: Filter by message types and agent names
7377
- **Authentication**: Uses API tokens for secure SSE stream access
74-
- **Configurable Connection**: Supports custom monitor URLs and filtering options
7578

7679
### Data Flow
7780
1. **STF File Detection**: Agent monitors directories for new STF files or receives data_ready messages
7881
2. **TF Simulation**: Generates TF subsamples from STF files based on configuration parameters
79-
3. **Database Recording**: Records both STF and TF metadata in swf-monitor database via REST API
82+
3. **Database Recording**: Records TF metadata in swf-monitor database via REST API
8083
4. **SSE Message Broadcasting**: Agent sends TF file notifications to swf-monitor's `/api/messages/` endpoint
8184
5. **Real-time Streaming**: swf-monitor broadcasts messages via SSE to connected clients at `/api/messages/stream/`
8285
6. **Client Display**: Client receives SSE stream and displays formatted TF information in real-time
@@ -87,8 +90,6 @@ The fast monitoring agent is configured through the swf-testbed ecosystem:
8790
- **Better Scalability**: SSE handles many concurrent read-only client connections efficiently
8891
- **Enhanced Security**: API token-based authentication with fine-grained access control
8992
- **Web Integration Ready**: Easy to add web-based dashboards that consume the same SSE stream
90-
- **Message Filtering**: Built-in filtering by message types and agent names at the server level
91-
- **Lower Latency**: Direct HTTP streaming eliminates message broker overhead
9293

9394
## SSE Client Usage
9495

requirements.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,8 @@ psycopg2-binary>=2.9.0
99
pytest>=7.0.0
1010
pytest-django>=4.5.0
1111
black>=22.0.0
12-
flake8>=4.0.0
12+
flake8>=4.0.0
13+
14+
# CLI and messaging
15+
typer>=0.9.0
16+
stomp.py>=8.1.0

src/swf_fastmon_client/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ monitor the ePIC data acquisition remotely.
1313

1414
The client is designed to receive metadata from the `swf-fastmon-agent` and display it in a user-friendly format/web interface.
1515

16-
* It uses ActiveMQ to receive TFs metadata via STOMP protocol.
17-
* Store the metadata in a configurable database backend using Django ORM (SQLite, PostgreSQL, or MySQL).
16+
* It uses ActiveMQ to receive TFs metadata via SSE protocol.
1817
* Uses Typer for command-line interface.
19-
* It can be extended to provide a web interface for monitoring
18+
* It can be extended to provide a web interface for monitoring (like a Grafana dashboard).

src/swf_fastmon_client/__init__.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +0,0 @@
1-
"""
2-
SWF Fast Monitoring Client
3-
4-
A Django-based client for receiving and storing Time Frame metadata from the
5-
ePIC Streaming Workflow Fast Monitoring Agent.
6-
"""
7-
8-
__version__ = "0.1.0"

0 commit comments

Comments
 (0)