fix: 修正CGI并固定数据库配置
This commit is contained in:
@@ -26,6 +26,13 @@ The script never modifies or deletes source storage files. By default it writes
|
||||
|
||||
The database table contains one time column, `metric_time DATETIME`, which is the source KPI start time. 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.
|
||||
|
||||
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 `metrix`, and table `interference_hourly_summary` are constants at the top of `main.py`; they are not project environment variables.
|
||||
|
||||
## Local development
|
||||
|
||||
```powershell
|
||||
@@ -45,7 +52,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` plus `openpyxl`, `et_xmlfile`, and `PyMySQL`. The builder verifies imports 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 ZIP is 325,932 bytes with SHA-256 `D57930E36B3C70DF7D209C4A83546FEA3B73F87022910D1FDB548D6BED71675D`.
|
||||
The generated `dist/InterferenceETL-offline-1.1.zip` contains `main.py` plus `openpyxl`, `et_xmlfile`, and `PyMySQL`. The builder verifies imports 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 ZIP is 325,489 bytes with SHA-256 `4F655D35F89A826F28A41578C9EE3E347CE31A27619D3D06AE0FD9587660DCAF`.
|
||||
|
||||
Create the project, then upload and extract the ZIP in its Script Management workspace. Use these project settings:
|
||||
|
||||
@@ -58,7 +65,7 @@ Run command: python main.py
|
||||
Timeout: 1800 seconds
|
||||
```
|
||||
|
||||
Configure project environment variables in Metrix instead of committing secrets:
|
||||
Configure only the Metrix source settings in the project environment:
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -67,18 +74,11 @@ Configure project environment variables in Metrix instead of committing secrets:
|
||||
"METRIX_STORAGE_ID": "stg_4d9a910d72",
|
||||
"INTERFERENCE_SOURCE_ROOT": "/网优日常优化数据文档/(勿删)干扰定时小时指标",
|
||||
"INTERFERENCE_OUTPUT_DIR": "/workspace/output",
|
||||
"INTERFERENCE_LOOKBACK_DAYS": "3",
|
||||
"INTERFERENCE_PLMN": "460-00",
|
||||
"INTERFERENCE_DB_HOST": "<reachable MySQL host>",
|
||||
"INTERFERENCE_DB_PORT": "3306",
|
||||
"INTERFERENCE_DB_USER": "<MySQL user>",
|
||||
"INTERFERENCE_DB_PASSWORD": "<MySQL password>",
|
||||
"INTERFERENCE_DB_NAME": "<database name>",
|
||||
"INTERFERENCE_DB_TABLE": "interference_hourly_summary"
|
||||
"INTERFERENCE_LOOKBACK_DAYS": "3"
|
||||
}
|
||||
```
|
||||
|
||||
`172.17.0.1` is the current Linux Docker default-bridge gateway used to reach the Metrix host port. Verify both API and MySQL addresses before creating the online schedule because Docker network configuration can differ by server. A container name such as `ShareMySQL` resolves only when the script container joins the same Docker network.
|
||||
`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.
|
||||
|
||||
## CLI options
|
||||
|
||||
@@ -91,12 +91,5 @@ Configure project environment variables in Metrix instead of committing secrets:
|
||||
--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
|
||||
--no-database Generate CSV files without writing MySQL
|
||||
--db-host HOST MySQL host or INTERFERENCE_DB_HOST
|
||||
--db-port PORT MySQL port, default 3306
|
||||
--db-user USER MySQL user
|
||||
--db-password VALUE MySQL password; prefer the environment variable
|
||||
--db-name NAME MySQL database name
|
||||
--db-table NAME Table name, default interference_hourly_summary
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user