Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
anselm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
vaclab
anselm
Commits
a67d496b
Commit
a67d496b
authored
6 years ago
by
wactbprot
Browse files
Options
Downloads
Patches
Plain Diff
go on at route offset
parent
a916a103
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
srv.py
+25
-8
25 additions, 8 deletions
srv.py
with
25 additions
and
8 deletions
srv.py
+
25
−
8
View file @
a67d496b
...
...
@@ -87,16 +87,17 @@ def dut_max():
@app.route
(
'
/target_pressures
'
,
methods
=
[
'
GET
'
])
def
target_pressure
():
s
.
log
.
info
(
"
request to target pressures
"
)
keys
=
s
.
r
.
keys
(
'
calid@*
'
)
target_pressure_values
=
[]
target_pressure_unit
=
"
Pa
"
res
=
{
"
Pressure_target
"
:
{
"
Target_pressure
"
:
{
"
Caption
"
:
"
target pressure
"
,
"
Unit
"
:
target_pressure_unit
,
"
Selected
"
:
"
1
"
,
"
Select
"
:
[]
}
}
keys
=
s
.
r
.
keys
(
'
calid@*
'
)
target_pressure_values
=
[]
target_pressure_unit
=
"
Pa
"
for
key
in
keys
:
calid
=
s
.
r
.
get
(
key
)
caldoc
=
db
.
get_doc
(
calid
)
...
...
@@ -107,7 +108,7 @@ def target_pressure():
if
todo_pressure
.
get
(
'
Unit
'
)
==
"
mbar
"
:
conv_factor
=
100
if
todo_pressure
.
get
(
'
Unit
'
)
==
"
Pa
"
:
if
todo_pressure
.
get
(
'
Unit
'
)
==
target_pressure_unit
:
conv_factor
=
1
for
v
in
todo_pressure
.
get
(
'
Value
'
):
...
...
@@ -124,10 +125,11 @@ def target_pressure():
for
v
in
sorted
(
target_pressure_values
):
formated_val
=
'
{:.1e}
'
.
format
(
v
)
if
first
:
res
[
'
Pressure_target
'
][
'
Selected
'
]
=
formated_val
res
[
'
Target_pressure
'
][
'
Selected
'
]
=
formated_val
res
[
'
Target_pressure
'
][
'
Unit
'
]
=
target_pressure_unit
first
=
False
res
[
'
Pressure_target
'
][
'
Select
'
].
append
({
'
value
'
:
formated_val
,
'
display
'
:
"
{} Pa
"
.
format
(
formated_val
)
})
res
[
'
Target_pressure
'
][
'
Select
'
].
append
({
'
value
'
:
formated_val
,
'
display
'
:
"
{} Pa
"
.
format
(
formated_val
)
})
else
:
msg
=
"
no target values found
"
s
.
log
.
error
(
msg
)
...
...
@@ -140,7 +142,7 @@ def target_pressure():
@app.route
(
'
/offset_sequences
'
,
methods
=
[
'
GET
'
])
def
offset_sequences
():
s
.
log
.
info
(
"
request to
target pressures
"
)
s
.
log
.
info
(
"
request to
offset sequence
"
)
keys
=
s
.
r
.
keys
(
'
offset_all_sequence@*
'
)
seq_array
=
[]
for
key
in
keys
:
...
...
@@ -157,6 +159,21 @@ def offset_sequences():
return
jsonify
(
res
)
@app.route
(
'
/offset
'
,
methods
=
[
'
POST
'
])
def
offset
():
s
.
log
.
info
(
"
request to offset
"
)
req
=
request
.
get_json
()
# find valid init by means of req.target_pressure
# init
# offset
# save if save=True
start_new_thread
(
work_seqence
,
(
sequence
,
line
,))
res
=
wait_sequences_complete
(
seq_array
)
return
jsonify
(
res
)
def
wait_sequences_complete
(
seq_array
):
s
.
p
.
subscribe
(
"
srv
"
)
s
.
log
.
info
(
'
start listening redis on channel srv
'
)
...
...
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