Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
lhc-sm-api
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LHCData
lhc-sm-api
Commits
782e2697
Commit
782e2697
authored
6 months ago
by
Simon Mazenoux
Browse files
Options
Downloads
Patches
Plain Diff
fix query_hwc_powering_test_parameters
parent
269ec514
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!386
fix query_hwc_powering_test_parameters
,
!381
Merge dev into master
Pipeline
#7926681
passed
6 months ago
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lhcsmapi/api/query.py
+6
-5
6 additions, 5 deletions
lhcsmapi/api/query.py
test/integration/test_query.py
+78
-0
78 additions, 0 deletions
test/integration/test_query.py
with
84 additions
and
5 deletions
lhcsmapi/api/query.py
+
6
−
5
View file @
782e2697
...
...
@@ -1049,10 +1049,11 @@ def query_hwc_powering_test_parameters(
if
duration
<
0
:
raise
ValueError
(
f
"
Duration cannot be negative, got
{
duration
}
"
)
pc_names
=
signal_metadata
.
get_fgc_names
(
circuit_name
,
start_time
)
for
pc_name
in
pc_names
:
old_pc_names
=
signal_metadata
.
get_fgc_names
(
circuit_name
,
start_time
)
new_pc_names
=
signal_metadata
.
get_fgc_names
(
circuit_name
,
datetime
.
now
())
for
old_pc_name
,
new_pc_name
in
zip
(
old_pc_names
,
new_pc_names
):
query
=
(
f
"
http://mpe-systems-pro-gpn:60242/v1/systemInformation/powerConverters/
{
pc_name
}
/
"
f
"
http://mpe-systems-pro-gpn:60242/v1/systemInformation/powerConverters/
{
new_
pc_name
}
/
"
f
"
params?startTimeInNanos=
{
start_time
}
&endTimeInNanos=
{
start_time
+
duration
}
"
)
logger
.
debug
(
f
"
Querying HWC powering test parameters using the following query:
{
query
}
"
)
...
...
@@ -1060,10 +1061,10 @@ def query_hwc_powering_test_parameters(
if
response
.
status_code
==
200
:
d
=
json
.
loads
(
response
.
text
)
if
d
:
res
[
pc_name
]
=
d
res
[
old_
pc_name
]
=
d
else
:
logger
.
warning
(
f
"
Querying HWC powering test parameters returned no data for the the pc
{
pc_name
}
"
f
"
Querying HWC powering test parameters returned no data for the the pc
{
new_
pc_name
}
"
f
"
(query:
{
query
}
)
"
)
else
:
...
...
This diff is collapsed.
Click to expand it.
test/integration/test_query.py
+
78
−
0
View file @
782e2697
...
...
@@ -253,6 +253,84 @@ def test_query_hwc_powering_test_parameters_valid_case(start_time, duration):
}
def
test_query_hwc_powering_test_parameters_renamed_fgc
():
# arrange
circuit_name
=
"
RQ6.R1
"
start_time
=
1492706598921000000
end_time
=
1492707382516000000
# act
result
=
query
.
query_hwc_powering_test_parameters
(
circuit_name
,
start_time
,
end_time
-
start_time
)
# assert
assert
result
==
{
"
RPHGB.RR17.RQ6.R1B1
"
:
{
"
ACC_PNO
"
:
{
"
unit
"
:
"
A/s²
"
,
"
value
"
:
2.0
},
"
DIDT_ASYN
"
:
{
"
unit
"
:
"
A/s
"
,
"
value
"
:
4.0
},
"
DIDT_PNO
"
:
{
"
unit
"
:
"
A/s
"
,
"
value
"
:
12.931
},
"
I_5TEV
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
2300.0
},
"
I_DELTA
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
50.0
},
"
I_EARTH_MAX
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
0.01
},
"
I_EARTH_PCC_MAX
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
0.01
},
"
I_ERR_MAX
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
0.05
},
"
I_ERR_PCC_MAX
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
0.04
},
"
I_HARDWARE
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
4650.0
},
"
I_INJECTION
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
206.0
},
"
I_INTERM_1
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
1300.0
},
"
I_INTERM_1_MID
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
750.0
},
"
I_INTERM_2
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
2300.0
},
"
I_INTERM_3
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
1900.0
},
"
I_INTERM_4
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
2300.0
},
"
I_PCC
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
150.0
},
"
I_PHASE_1
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
700.0
},
"
I_PNO
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
4050.0
},
"
I_PNO_MID
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
1250.0
},
"
I_PNO_TRAINING
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
4100.0
},
"
I_SM_INT_1
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
1200.0
},
"
I_SM_INT_2
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
1700.0
},
"
L_TOT
"
:
{
"
unit
"
:
"
H
"
,
"
value
"
:
0.021
},
"
R_TOT_MEASURED
"
:
{
"
unit
"
:
"
Ω
"
,
"
value
"
:
0.000264
},
"
TIME_PCC
"
:
{
"
unit
"
:
"
s
"
,
"
value
"
:
30.0
},
"
TIME_PNO_LEADS
"
:
{
"
unit
"
:
"
s
"
,
"
value
"
:
3600.0
},
"
TIME_TOP
"
:
{
"
unit
"
:
"
s
"
,
"
value
"
:
300.0
},
"
TIME_ZERO
"
:
{
"
unit
"
:
"
s
"
,
"
value
"
:
60.0
},
"
U_IND
"
:
{
"
unit
"
:
"
V
"
,
"
value
"
:
0.271
},
},
"
RPHGB.RR17.RQ6.R1B2
"
:
{
"
ACC_PNO
"
:
{
"
unit
"
:
"
A/s²
"
,
"
value
"
:
2.0
},
"
DIDT_ASYN
"
:
{
"
unit
"
:
"
A/s
"
,
"
value
"
:
4.0
},
"
DIDT_PNO
"
:
{
"
unit
"
:
"
A/s
"
,
"
value
"
:
12.931
},
"
I_5TEV
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
2300.0
},
"
I_DELTA
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
50.0
},
"
I_EARTH_MAX
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
0.01
},
"
I_EARTH_PCC_MAX
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
0.01
},
"
I_ERR_MAX
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
0.05
},
"
I_ERR_PCC_MAX
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
0.04
},
"
I_HARDWARE
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
4650.0
},
"
I_INJECTION
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
206.0
},
"
I_INTERM_1
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
1300.0
},
"
I_INTERM_1_MID
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
750.0
},
"
I_INTERM_2
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
2300.0
},
"
I_INTERM_3
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
1900.0
},
"
I_INTERM_4
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
2300.0
},
"
I_PCC
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
150.0
},
"
I_PHASE_1
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
700.0
},
"
I_PNO
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
4050.0
},
"
I_PNO_MID
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
1250.0
},
"
I_PNO_TRAINING
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
4100.0
},
"
I_SM_INT_1
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
1200.0
},
"
I_SM_INT_2
"
:
{
"
unit
"
:
"
A
"
,
"
value
"
:
1700.0
},
"
L_TOT
"
:
{
"
unit
"
:
"
H
"
,
"
value
"
:
0.021
},
"
R_TOT_MEASURED
"
:
{
"
unit
"
:
"
Ω
"
,
"
value
"
:
0.000237
},
"
TIME_PCC
"
:
{
"
unit
"
:
"
s
"
,
"
value
"
:
30.0
},
"
TIME_PNO_LEADS
"
:
{
"
unit
"
:
"
s
"
,
"
value
"
:
3600.0
},
"
TIME_TOP
"
:
{
"
unit
"
:
"
s
"
,
"
value
"
:
300.0
},
"
TIME_ZERO
"
:
{
"
unit
"
:
"
s
"
,
"
value
"
:
60.0
},
"
U_IND
"
:
{
"
unit
"
:
"
V
"
,
"
value
"
:
0.271
},
},
},
result
def
test_query_hwc_powering_test_parameters_invalid_query
(
caplog
:
pytest
.
LogCaptureFixture
):
# arrange
circuit_name
=
"
RD4.R4
"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment