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
e6723de5
Commit
e6723de5
authored
6 years ago
by
wactbprot
Browse files
Options
Downloads
Patches
Plain Diff
start with save results
parent
9ab309c3
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
anselm.py
+4
-1
4 additions, 1 deletion
anselm.py
anselm/db.py
+30
-1
30 additions, 1 deletion
anselm/db.py
anselm/worker.py
+3
-0
3 additions, 0 deletions
anselm/worker.py
srv.py
+5
-5
5 additions, 5 deletions
srv.py
with
42 additions
and
7 deletions
anselm.py
+
4
−
1
View file @
e6723de5
...
...
@@ -153,6 +153,9 @@ class Anselm(System):
def
end_task
(
self
,
line
):
self
.
add_widget_to_grid
(
self
.
make_result_label
(
line
=
line
),
line
,
self
.
result_col
)
if
self
.
aget
(
'
save
'
,
0
)
==
"
yes
"
:
self
.
db
.
save_results
()
self
.
log
.
info
(
"
end task at line {}
"
.
format
(
line
))
...
...
@@ -351,7 +354,7 @@ class Anselm(System):
def
cal_id_selected
(
self
,
combo
,
line
):
cal_id
=
combo
.
currentText
()
self
.
aset
(
'
calid
'
,
line
,
cal_id
)
self
.
aset
(
'
cal
_
id
'
,
line
,
cal_id
)
self
.
log
.
info
(
"
select calibration id {}
"
.
format
(
cal_id
))
def
fullscale_selected
(
self
,
combo
,
line
):
...
...
This diff is collapsed.
Click to expand it.
anselm/db.py
+
30
−
1
View file @
e6723de5
...
...
@@ -114,6 +114,11 @@ class DB(System):
self
.
log
.
error
(
"
document with id: {} does not exist
"
.
format
(
id
))
return
None
def
set_doc
(
self
,
doc
):
self
.
log
.
info
(
"
try to save document
"
)
res
=
self
.
db
.
save
(
doc
)
self
.
log
.
info
(
res
)
def
replace_defaults
(
self
,
task
,
defaults
):
strtask
=
json
.
dumps
(
task
)
if
isinstance
(
defaults
,
dict
):
...
...
@@ -157,4 +162,28 @@ class DB(System):
self
.
aset
(
'
task
'
,
line
,
task
)
self
.
aset
(
'
task_db
'
,
line
,
task_db
)
else
:
self
.
log
.
error
(
"
line {} contains no doc_id
"
)
\ No newline at end of file
self
.
log
.
error
(
"
line {} contains no doc_id
"
)
def
save_results
(
self
):
cal_keys
=
self
.
r
.
keys
(
"
cal_id@*
"
)
for
cal_key
in
cal_keys
:
_
,
line
=
cal_key
.
split
(
self
.
keysep
)
doc_path
=
self
.
aget
(
"
doc_path
"
,
line
)
results
=
self
.
dget
(
"
result
"
,
line
)
self
.
log
.
debug
(
"
try to save results: {}
"
.
format
(
results
))
if
doc_path
and
results
:
doc_path_array
=
doc_path
.
split
(
"
.
"
)
cal_id
=
self
.
aget
(
"
cal_id
"
,
line
)
doc
=
self
.
get_doc
(
cal_id
)
for
result
in
results
:
self
.
log
.
debug
(
"
save components are cal_id {}, doc_path_array: {}, result: {}
"
.
format
(
cal_id
,
doc_path_array
,
result
))
self
.
doc_write_result
(
doc
,
doc_path_array
,
result
)
self
.
set_doc
(
doc
)
def
doc_write_result
(
self
,
doc
,
doc_path_array
,
result
):
for
key
in
doc_path_array
[:
-
1
]:
doc
=
doc
.
setdefault
(
key
,
{})
if
not
doc_path_array
[
-
1
]
in
doc
:
doc
[
doc_path_array
[
-
1
]]
=
[]
doc
[
doc_path_array
[
-
1
]].
append
(
result
)
This diff is collapsed.
Click to expand it.
anselm/worker.py
+
3
−
0
View file @
e6723de5
...
...
@@ -48,6 +48,9 @@ class Worker(System):
req
=
requests
.
post
(
self
.
relay_url
,
data
=
json
.
dumps
(
task
),
headers
=
self
.
headers
)
res
=
req
.
json
()
if
'
DocPath
'
in
task
:
self
.
aset
(
'
doc_path
'
,
line
,
task
[
'
DocPath
'
],
expire
=
False
)
if
'
Result
'
in
res
:
self
.
aset
(
'
result
'
,
line
,
res
[
'
Result
'
],
expire
=
False
)
...
...
This diff is collapsed.
Click to expand it.
srv.py
+
5
−
5
View file @
e6723de5
...
...
@@ -22,14 +22,14 @@ def home():
@app.route
(
'
/cal_ids
'
)
def
calids
():
keys
=
s
.
r
.
keys
(
'
calid@*
'
)
calids
=
[]
keys
=
s
.
r
.
keys
(
'
cal
_
id@*
'
)
cal
_
ids
=
[]
for
key
in
keys
:
calids
.
append
(
s
.
r
.
get
(
key
))
cal
_
ids
.
append
(
s
.
r
.
get
(
key
))
s
.
log
.
info
(
"
request cal ids
"
)
return
jsonify
({
"
ids
"
:
calids
})
return
jsonify
({
"
ids
"
:
cal
_
ids
})
@app.route
(
'
/dut_max
'
,
methods
=
[
'
GET
'
])
def
dut_max
():
...
...
@@ -89,7 +89,7 @@ def dut_max():
@app.route
(
'
/target_pressures
'
,
methods
=
[
'
GET
'
])
def
target_pressure
():
s
.
log
.
info
(
"
request to target pressures
"
)
keys
=
s
.
r
.
keys
(
'
calid@*
'
)
keys
=
s
.
r
.
keys
(
'
cal
_
id@*
'
)
target_pressure_values
=
[]
res
=
{
...
...
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