feat: 实现干扰小时指标自动处理
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
# InterferenceETL
|
||||
|
||||
InterferenceETL processes the newest complete hour of interference KPI files from Metrix storage. It reads seven ZIP/XLSX source types, converts each `Sheet0` to CSV, and creates one merged interference summary.
|
||||
|
||||
## Output
|
||||
|
||||
Each run writes one window directory:
|
||||
|
||||
```text
|
||||
output/2026073110001100/
|
||||
├── converted/
|
||||
│ ├── 5G下FDD干扰监控_2026073110001100.csv
|
||||
│ ├── 5G干扰监控_2026073110001100.csv
|
||||
│ └── ... seven source CSV files
|
||||
├── interference_summary_2026073110001100.csv
|
||||
└── manifest.json
|
||||
```
|
||||
|
||||
The summary columns are:
|
||||
|
||||
```text
|
||||
hour_start,hour_end,source_type,cgi,cell_name,interference_dbm,source_path
|
||||
```
|
||||
|
||||
The script never modifies source storage and does not write a database yet. Pending decisions are recorded in `docs/assumptions.md`.
|
||||
|
||||
## Local development
|
||||
|
||||
```powershell
|
||||
python -m pip install -r requirements.txt
|
||||
python -m unittest discover -s tests -v
|
||||
python main.py --source-dir C:\path\to\mock-or-exported-tree --output-dir output
|
||||
```
|
||||
|
||||
Use `--window 2026073110001100` to require one exact source window. Without it, the script selects the newest window containing all seven source types and falls back if the newest observed window is incomplete.
|
||||
|
||||
## Metrix Script Management
|
||||
|
||||
The target server is offline, so build the runtime image on a connected machine and import it through Metrix Container Management:
|
||||
|
||||
```powershell
|
||||
docker build -t interference-etl-runtime:1.0 .
|
||||
New-Item -ItemType Directory -Force dist | Out-Null
|
||||
docker save -o dist\interference-etl-runtime-1.0.tar interference-etl-runtime:1.0
|
||||
```
|
||||
|
||||
The local `dist/` directory is intentionally excluded from Git. Transfer the generated TAR as a deployment artifact rather than source code.
|
||||
|
||||
Create the Metrix script project with:
|
||||
|
||||
```text
|
||||
Name: InterferenceETL
|
||||
Language: python
|
||||
Base image: interference-etl-runtime:1.0
|
||||
Network: bridge
|
||||
Run command: python main.py
|
||||
Timeout: 1800 seconds
|
||||
```
|
||||
|
||||
Configure project environment variables in Metrix instead of committing secrets:
|
||||
|
||||
```json
|
||||
{
|
||||
"METRIX_API_BASE_URL": "http://172.17.0.1:8000",
|
||||
"METRIX_API_TOKEN": "<Metrix API token>",
|
||||
"METRIX_STORAGE_ID": "stg_4d9a910d72",
|
||||
"INTERFERENCE_SOURCE_ROOT": "/网优日常优化数据文档/(勿删)干扰定时小时指标",
|
||||
"INTERFERENCE_OUTPUT_DIR": "/workspace/output",
|
||||
"INTERFERENCE_LOOKBACK_DAYS": "3",
|
||||
"INTERFERENCE_PLMN": "460-00"
|
||||
}
|
||||
```
|
||||
|
||||
`172.17.0.1` is the current Linux Docker default-bridge gateway used to reach the Metrix host port. Verify it before creating the online schedule because Docker bridge configuration can differ by server.
|
||||
|
||||
## CLI options
|
||||
|
||||
```text
|
||||
--source-dir PATH Read a local directory tree instead of Metrix API
|
||||
--output-dir PATH Output root, default output or INTERFERENCE_OUTPUT_DIR
|
||||
--window WINDOW Require an exact 16-digit source window
|
||||
--lookback-days N Number of newest date directories scanned, default 3
|
||||
--api-base URL Metrix API base URL
|
||||
--api-token TOKEN Metrix API token
|
||||
--storage-id ID Metrix storage connection ID
|
||||
--root PATH Source directory in Metrix storage
|
||||
--plmn PLMN LTE/SDR CGI PLMN prefix, default 460-00
|
||||
```
|
||||
Reference in New Issue
Block a user