feat: 改用Metrix API写入干扰数据
This commit is contained in:
@@ -24,7 +24,7 @@ The summary columns are:
|
||||
hour_start,hour_end,cgi,cell_name,interference_dbm,longitude,latitude
|
||||
```
|
||||
|
||||
The script never modifies or deletes source storage files. By default it writes the complete selected hour to MySQL and keeps only that hour in the target table.
|
||||
The script never modifies or deletes source storage files. By default it writes the complete selected hour through the Metrix Database API and keeps only that hour in the target table.
|
||||
|
||||
The database table contains one time column, `metric_time DATETIME`, which is the source KPI start time, plus nullable `longitude` and `latitude` columns. A same-hour rerun replaces that whole batch. After a successful insert, rows for every other hour are deleted in the same transaction. The script refuses to replace a newer database hour with an older source hour.
|
||||
|
||||
@@ -33,7 +33,7 @@ CGI is generated with fixed rules:
|
||||
- NR (`5G干扰监控`, `700M干扰监控`): `{gNBplmn}-{gNBId}-{cellId}`.
|
||||
- 4G (the other five source types): `460-00-{eNodeBID}-{小区ID}`, using each source schema's actual equivalent column names.
|
||||
|
||||
MySQL connection values, database `interference_etl`, and table `interference_hourly_summary` are constants at the top of `main.py`; they are not project environment variables. The script creates its database and table automatically when they do not exist.
|
||||
The Metrix API address, API Token, and database connection ID are constants in `runtime_config.py`; they are not project environment variables. Copy `runtime_config.example.py` to `runtime_config.py` and fill in the actual Token and the `conn_id` of `ShareMySQL`. The fixed database is `interference_etl`, the fixed table is `interference_hourly_summary`, and the script creates both automatically when they do not exist.
|
||||
|
||||
The five CellData directories are fixed in `CELL_DATA_DIRECTORIES`. In each directory, only XLSX files ending with a valid `YYYYMMDD.xlsx` date are considered, and the latest date is selected.
|
||||
|
||||
@@ -56,7 +56,7 @@ docker build -t interference-etl-runtime:1.1 .
|
||||
python scripts\build_offline_package.py
|
||||
```
|
||||
|
||||
The generated `dist/InterferenceETL-offline-1.1.zip` contains `main.py`, a ZIP execution entry point, and a `vendor/` directory containing `openpyxl`, `et_xmlfile`, and `PyMySQL`. The builder verifies both imports and ZIP execution using the standard `python:3.13.11-slim` image, so the uploaded workspace does not need an online `pip install` or a custom runtime image.
|
||||
The generated `dist/InterferenceETL-offline-1.1.zip` contains `main.py`, `runtime_config.py`, a ZIP execution entry point, and a `vendor/` directory containing `openpyxl` and `et_xmlfile`. The builder verifies imports and ZIP execution using the standard `python:3.13.11-slim` image, so the uploaded workspace does not need an online `pip install` or a custom runtime image. The build fails when `runtime_config.py` is missing.
|
||||
|
||||
Create the project, then upload and extract the ZIP in its Script Management workspace. The normal file tree should contain `main.py` at `/workspace/main.py`. Use these project settings:
|
||||
|
||||
@@ -71,12 +71,10 @@ Timeout: 1800 seconds
|
||||
|
||||
If the server keeps the ZIP as one file instead of extracting it, use `python InterferenceETL-offline-1.1.zip` as the run command. The ZIP contains `__main__.py` for this mode.
|
||||
|
||||
Configure only the Metrix source settings in the project environment:
|
||||
Configure only run-specific source and output settings in the project environment:
|
||||
|
||||
```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",
|
||||
@@ -84,7 +82,7 @@ Configure only the Metrix source settings in the project environment:
|
||||
}
|
||||
```
|
||||
|
||||
`172.17.0.1` is the current Linux Docker default-bridge gateway used by the script to reach both the Metrix API and the host-published MySQL port. `ShareMySQL` itself does not resolve from the script project's bridge network.
|
||||
Both storage reads and database writes use the Metrix API at `http://188.5.127.115:18271`. SSH remains the deployment and operational channel for uploading files, starting runs, and reading logs.
|
||||
|
||||
## CLI options
|
||||
|
||||
@@ -93,9 +91,7 @@ Configure only the Metrix source settings in the project environment:
|
||||
--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
|
||||
--no-database Generate CSV files without writing MySQL
|
||||
--no-database Generate CSV files without writing the database
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user