Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review 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
RadioObservatory
LOFAR
Commits
227a0070
Commit
227a0070
authored
8 years ago
by
Jorrit Schaap
Browse files
Options
Downloads
Patches
Plain Diff
Task #9607: logging, minor fix
parent
752bb0f5
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
SAS/DataManagement/StorageQueryService/cache.py
+8
-4
8 additions, 4 deletions
SAS/DataManagement/StorageQueryService/cache.py
SAS/ResourceAssignment/ResourceAssignmentEditor/lib/storage.py
+4
-5
4 additions, 5 deletions
...esourceAssignment/ResourceAssignmentEditor/lib/storage.py
with
12 additions
and
9 deletions
SAS/DataManagement/StorageQueryService/cache.py
+
8
−
4
View file @
227a0070
...
...
@@ -123,7 +123,7 @@ class CacheManager:
if
du_result
[
'
found
'
]:
if
not
path
in
path_cache
or
path_cache
[
path
][
'
disk_usage
'
]
!=
du_result
[
'
disk_usage
'
]:
logger
.
debug
(
'
updating cache entry: %s
'
,
du_result
)
logger
.
info
(
'
updating cache entry: %s
'
,
du_result
)
path_cache
[
path
]
=
du_result
self
.
_sendDiskUsageChangedNotification
(
path
,
du_result
[
'
disk_usage
'
],
otdb_id
)
...
...
@@ -161,7 +161,7 @@ class CacheManager:
with
self
.
_cacheLock
:
path_cache
=
self
.
_cache
[
'
path_du_results
'
]
if
directory
not
in
path_cache
:
if
not
directory
in
path_cache
:
logger
.
info
(
'
tree scan: adding
\'
%s
\'
with empty disk_usage to cache which will be du
\'
ed later
'
,
directory
)
empty_du_result
=
{
'
found
'
:
True
,
'
disk_usage
'
:
None
,
'
path
'
:
directory
,
'
name
'
:
directory
.
split
(
'
/
'
)[
-
1
]}
self
.
_updateCache
(
empty_du_result
)
...
...
@@ -211,6 +211,10 @@ class CacheManager:
if
depth1
==
2
or
depth2
==
2
:
if
depth1
==
2
and
depth2
==
2
:
if
not
entry1
[
'
disk_usage
'
]:
return
-
1
if
not
entry2
[
'
disk_usage
'
]:
return
1
if
entry1
[
'
cache_timestamp
'
]
<
entry2
[
'
cache_timestamp
'
]:
return
-
1
if
entry1
[
'
cache_timestamp
'
]
>
entry2
[
'
cache_timestamp
'
]:
...
...
@@ -242,7 +246,7 @@ class CacheManager:
logger
.
info
(
'
examining old entry %s/%s in cache: %s
'
,
i
,
len
(
old_entries
),
path
)
result
=
du_getDiskUsageForPath
(
path
)
if
result
[
'
found
'
]:
logger
.
info
(
'
updat
ing
old entry in cache: %s
'
,
result
)
logger
.
debug
(
'
trying to
updat
e
old entry in cache: %s
'
,
result
)
self
.
_updateCache
(
result
)
except
Exception
as
e
:
logger
.
error
(
str
(
e
))
...
...
@@ -253,7 +257,7 @@ class CacheManager:
if
datetime
.
datetime
.
utcnow
()
-
cacheUpdateStart
>
datetime
.
timedelta
(
minutes
=
5
):
# break out of cache update loop if full update takes more than 5min
# next loop we'll start with the oldest cache entries again
logger
.
info
(
'
skipping remaining old cache entries updates, they will be updated next time
'
)
logger
.
info
(
'
skipping remaining
%s
old cache entries updates, they will be updated next time
'
,
len
(
old_entries
)
-
i
)
break
for
i
in
range
(
60
):
...
...
This diff is collapsed.
Click to expand it.
SAS/ResourceAssignment/ResourceAssignmentEditor/lib/storage.py
+
4
−
5
View file @
227a0070
...
...
@@ -31,16 +31,15 @@ import logging
logger
=
logging
.
getLogger
(
__name__
)
def
updateTaskStorageDetails
(
tasks
,
sqrpc
):
if
not
tasks
:
return
def
applyDefaults
(
task
):
'''
apply sane default values for a task
'''
task
[
'
disk_usage
'
]
=
None
task
[
'
disk_usage_readable
'
]
=
None
try
:
_
=
(
t
for
t
in
tasks
)
except
TypeError
:
# make single task instance a list
tasks
=
[
tasks
]
tasks
=
tasks
if
isinstance
(
tasks
,
list
)
else
[
tasks
]
for
task
in
tasks
:
applyDefaults
(
task
)
...
...
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