Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
U
unify_api2
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
chaonan
unify_api2
Commits
ad031b1b
Commit
ad031b1b
authored
May 12, 2023
by
wang.wenrong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix_2s_downloads
parent
53467480
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
20 deletions
+26
-20
scope_operations_pds.py
unify_api/modules/anshiu/procedures/scope_operations_pds.py
+25
-19
scope_operations_serv.py
unify_api/modules/anshiu/service/scope_operations_serv.py
+1
-1
No files found.
unify_api/modules/anshiu/procedures/scope_operations_pds.py
View file @
ad031b1b
import
asyncio
import
datetime
import
json
import
math
...
...
@@ -73,31 +74,36 @@ async def get_scope_list_by_pid(pids, start_dt, end_dt, scope_g="2s"):
scope_list
=
[]
starttime_wm
=
datetime
.
datetime
.
now
()
print
(
f
'起始时间:{starttime_wm}'
)
task_list
=
[]
for
scope_data
in
scope_url_data
:
try
:
async
with
QsClient
()
as
qs
:
url
=
scope_data
.
get
(
"url"
)
wave_data
=
await
qs
.
get_object
(
url
)
[
scope_list
.
append
({
"datetime"
:
scope_data
[
'datetime'
],
"ua"
:
wave_data
[
'ua'
][
i
],
"ub"
:
wave_data
[
'ub'
][
i
],
"uc"
:
wave_data
[
'uc'
][
i
],
"ia"
:
wave_data
[
'ia'
][
i
],
"ib"
:
wave_data
[
'ib'
][
i
],
"ic"
:
wave_data
[
'ic'
][
i
],
"lc"
:
wave_data
[
'lc'
][
i
],
"pttl"
:
wave_data
[
'pttl'
][
i
]})
for
i
in
range
(
len
(
wave_data
.
get
(
'ua'
)))]
# for i in range(len(wave_data['ua'])):
# a_dict = dict(zip(wave_data.keys(),
# list(zip(*wave_data.values()))[i]))
# a_dict["datetime"] = scope_data['datetime']
# scope_list.append(a_dict)
url
=
scope_data
.
get
(
"url"
)
task_list
.
append
(
get_qs_datas
(
url
))
except
Exception
as
e
:
LOGGER
.
error
(
f
"scope_detail_service error message:{str(e)}"
)
return
[]
qs_dats
=
await
asyncio
.
gather
(
*
task_list
)
qs_data_map
=
{
data
[
0
]:
data
[
1
]
for
data
in
qs_dats
}
for
scope_data
in
scope_url_data
:
url
=
scope_data
.
get
(
"url"
)
wave_data
=
qs_data_map
[
url
]
[
scope_list
.
append
({
"datetime"
:
scope_data
[
'datetime'
],
"ua"
:
wave_data
[
'ua'
][
i
],
"ub"
:
wave_data
[
'ub'
][
i
],
"uc"
:
wave_data
[
'uc'
][
i
],
"ia"
:
wave_data
[
'ia'
][
i
],
"ib"
:
wave_data
[
'ib'
][
i
],
"ic"
:
wave_data
[
'ic'
][
i
],
"lc"
:
wave_data
[
'lc'
][
i
],
"pttl"
:
wave_data
[
'pttl'
][
i
]})
for
i
in
range
(
len
(
wave_data
.
get
(
'ua'
)))]
end_time_wm
=
datetime
.
datetime
.
now
()
print
(
f
'结束时间:{end_time_wm}'
)
return
scope_list
async
def
get_qs_datas
(
url
):
async
with
QsClient
()
as
qs
:
wave_data
=
await
qs
.
get_object
(
url
)
return
url
,
wave_data
unify_api/modules/anshiu/service/scope_operations_serv.py
View file @
ad031b1b
...
...
@@ -510,7 +510,7 @@ async def scope_detail_service(event_id):
wave_data
=
await
qs
.
get_object
(
url
)
except
Exception
as
e
:
LOGGER
.
error
(
f
"scope_detail_service error message:{str(e)}"
)
return
{},
[],
[],
[],
[]
,
[],
[],
[],
[]
return
{},
[],
[],
[],
[]
# 录波颗粒度
scope_g
=
scope_data
.
get
(
"scope_g"
)
if
ctnum
==
2
:
...
...
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