Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
E
ems_collector
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ZZH
ems_collector
Commits
618fb01f
Commit
618fb01f
authored
Jul 13, 2026
by
wwr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add water history data
parent
ad3b0a89
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
4 deletions
+29
-4
backfill_water_pg_1day.py
src/ems_water_grp/backfill_water_pg_1day.py
+29
-4
No files found.
src/ems_water_grp/backfill_water_pg_1day.py
View file @
618fb01f
...
...
@@ -3,7 +3,7 @@
Backfill water/pressure daily history points from Influx origin queryPeriod.
Usage:
python
-m ems_water_grp.backfill_water_pg_1da
y
\
python
ems_water_grp/backfill_water_pg_1day.p
y
\
--start "2025-07-13 00:00:00"
\
--end "2025-07-13 23:59:59"
...
...
@@ -18,21 +18,46 @@ Notes:
import
argparse
import
asyncio
import
importlib.util
import
json
import
os
from
collections
import
defaultdict
from
decimal
import
Decimal
,
ROUND_HALF_UP
from
pathlib
import
Path
from
typing
import
Dict
,
Iterable
,
List
,
Optional
,
Tuple
import
pendulum
from
ems_water_grp.constants
import
WATER_PG_MAP
,
WATER_SCADA_MAP
from
infra.config.settings
import
SETTING
from
infra.http.httpx_util
import
HttpxClient
from
infra.logger.logger
import
Logger
from
infra.mysql.aiomysql_util
import
MysqlUtil
from
utils.time_format
import
CST
,
YMD_Hms
def
_init_writable_log_base
():
log_base
=
os
.
environ
.
get
(
"EMS_COLLECTOR_LOG_BASE"
)
if
not
log_base
:
log_base
=
str
(
Path
.
cwd
()
/
"log"
)
Path
(
log_base
)
.
mkdir
(
parents
=
True
,
exist_ok
=
True
)
Logger
.
base_path
=
log_base
def
_load_water_constants
():
constants_path
=
Path
(
__file__
)
.
with_name
(
"constants.py"
)
spec
=
importlib
.
util
.
spec_from_file_location
(
"_backfill_water_constants"
,
constants_path
)
module
=
importlib
.
util
.
module_from_spec
(
spec
)
spec
.
loader
.
exec_module
(
module
)
return
module
.
WATER_SCADA_MAP
,
module
.
WATER_PG_MAP
_init_writable_log_base
()
WATER_SCADA_MAP
,
WATER_PG_MAP
=
_load_water_constants
()
from
infra.http.httpx_util
import
HttpxClient
from
infra.mysql.aiomysql_util
import
MysqlUtil
log_name
=
"backfill_water_pg_1day"
Logger
.
init_logger_path
(
"./ems_water_grp"
,
f
"{log_name}.log"
,
log_name
)
logger
=
Logger
.
getLogger
(
log_name
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment