Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bdaq53
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
silab
bdaq53
Commits
d522cf59
Commit
d522cf59
authored
4 years ago
by
David-Leon Pohl
Browse files
Options
Downloads
Plain Diff
Merge branch 'fix_db' into 'development'
Fix
#423
Closes
#423
See merge request
!395
parents
b52aafe6
6d2d94f3
No related branches found
No related tags found
2 merge requests
!418
Release v1.5.0
,
!395
Fix #423
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bdaq53/manage_databases.py
+6
-5
6 additions, 5 deletions
bdaq53/manage_databases.py
with
6 additions
and
5 deletions
bdaq53/manage_databases.py
+
6
−
5
View file @
d522cf59
...
...
@@ -16,7 +16,8 @@ import os
import
time
from
datetime
import
datetime
import
yaml
import
urllib.error
,
urllib
.
request
import
urllib.request
import
urllib.error
import
sqlite3
from
lxml
import
html
...
...
@@ -83,10 +84,10 @@ def _cache_rd53a_db(outfile=None, **_):
try
:
urllib
.
request
.
urlretrieve
(
uri
,
outfile
)
except
urllib
.
error
.
HTTPError
:
except
(
urllib
.
error
.
HTTPError
,
urllib
.
error
.
URLError
)
:
raise
DBUnreachableError
(
'
Cannot connect to RD53A database. Are you offline?
'
)
log
.
info
(
'
RD53 database has been cached to {0} in {1:1.3f}s
'
.
format
(
outfile
,
time
.
time
()
-
start_timer
))
log
.
debug
(
'
RD53 database has been cached to {0} in {1:1.3f}s
'
.
format
(
outfile
,
time
.
time
()
-
start_timer
))
def
_get_chip_from_rd53a_db_cache
(
wafer_no
,
col
,
row
,
infile
=
None
,
**
_
):
...
...
@@ -126,13 +127,13 @@ def _get_chip_from_rd53a_db_cache(wafer_no, col, row, infile=None, **_):
log
.
error
(
'
Cannot find cached version of RD53A database!
'
)
raise
DBCacheNotFoundError
(
"
No such file:
'
{0}
'"
.
format
(
infile
))
log
.
info
(
'
Reading data from cache file {}
'
.
format
(
infile
))
log
.
debug
(
'
Reading data from cache file {}
'
.
format
(
infile
))
creation_date
=
os
.
path
.
getmtime
(
infile
)
if
time
.
time
()
-
creation_date
>
(
24
*
60
*
60
):
log
.
warning
(
'
Cached data is older than 24h, consider creating a new cache. Creation date {}
'
.
format
(
datetime
.
fromtimestamp
(
creation_date
)))
elif
time
.
time
()
-
creation_date
>
1
:
log
.
info
(
'
Cache file was created {}
'
.
format
(
datetime
.
fromtimestamp
(
creation_date
)))
log
.
debug
(
'
Cache file was created {}
'
.
format
(
datetime
.
fromtimestamp
(
creation_date
)))
cache
=
sqlite3
.
connect
(
infile
)
cache
.
row_factory
=
dict_factory
...
...
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