Skip to content
GitLab
Explore
Sign in
Register
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
985d015b
Commit
985d015b
authored
5 years ago
by
Jorrit Schaap
Browse files
Options
Downloads
Patches
Plain Diff
SW-772
: get task and scratch paths in parallel.
parent
3a165821
No related branches found
Branches containing commit
No related tags found
1 merge request
!8
Cobalt2 multithreading fix
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
SAS/DataManagement/StorageQueryService/cache.py
+19
-11
19 additions, 11 deletions
SAS/DataManagement/StorageQueryService/cache.py
with
19 additions
and
11 deletions
SAS/DataManagement/StorageQueryService/cache.py
+
19
−
11
View file @
985d015b
...
@@ -373,7 +373,7 @@ class CacheManager:
...
@@ -373,7 +373,7 @@ class CacheManager:
subdir_paths
=
[
sdp
for
sdp
in
all_dirs
subdir_paths
=
[
sdp
for
sdp
in
all_dirs
if
sdp
.
startswith
(
path
)
and
sdp
.
count
(
'
/
'
)
==
path_depth
+
1
]
if
sdp
.
startswith
(
path
)
and
sdp
.
count
(
'
/
'
)
==
path_depth
+
1
]
subdir_du_results
=
[
self
.
getDiskUsageForPath
(
s
d
,
force_update
=
force_update
)
for
sd
in
subdir_paths
]
subdir_du_results
=
self
.
getDiskUsageForPath
s
(
s
ubdir_paths
,
force_update
=
force_update
)
.
values
()
valid_subdir_du_results
=
[
du
for
du
in
subdir_du_results
if
du
.
get
(
'
disk_usage
'
)]
valid_subdir_du_results
=
[
du
for
du
in
subdir_du_results
if
du
.
get
(
'
disk_usage
'
)]
sum_du
=
sum
([
du
[
'
disk_usage
'
]
for
du
in
valid_subdir_du_results
])
sum_du
=
sum
([
du
[
'
disk_usage
'
]
for
du
in
valid_subdir_du_results
])
...
@@ -500,19 +500,27 @@ class CacheManager:
...
@@ -500,19 +500,27 @@ class CacheManager:
path_result
=
self
.
disk_usage
.
path_resolver
.
getPathForTask
(
radb_id
=
radb_id
,
mom_id
=
mom_id
,
otdb_id
=
otdb_id
,
include_scratch_paths
=
include_scratch_paths
)
path_result
=
self
.
disk_usage
.
path_resolver
.
getPathForTask
(
radb_id
=
radb_id
,
mom_id
=
mom_id
,
otdb_id
=
otdb_id
,
include_scratch_paths
=
include_scratch_paths
)
if
path_result
[
'
found
'
]:
if
path_result
[
'
found
'
]:
path_du_result
=
self
.
getDiskUsageForPath
(
path_result
[
'
path
'
],
force_update
=
force_update
)
task_path
=
path_result
[
'
path
'
]
path_du_result
[
'
radb_id
'
]
=
path_result
.
get
(
'
radb_id
'
)
scratch_paths
=
path_result
.
get
(
'
scratch_paths
'
,
[])
path_du_result
[
'
mom_id
'
]
=
path_result
.
get
(
'
mom_id
'
)
path_du_result
[
'
otdb_id
'
]
=
path_result
.
get
(
'
otdb_id
'
)
if
'
scratch_paths
'
in
path_result
:
# get all du's in parallel over all paths
path_du_result
[
'
scratch_paths
'
]
=
{}
paths
=
[
task_path
]
+
scratch_paths
paths_du_result
=
self
.
getDiskUsageForPaths
(
paths
,
force_update
=
force_update
)
# split into project and subdir
path_du_result
=
paths_du_result
.
pop
(
task_path
)
scratch_du_result
=
paths_du_result
task_du_result
=
dict
(
path_du_result
)
# yield id's for if available, or None
for
id
in
[
'
radb_id
'
,
'
otdb_id
'
,
'
mom_id
'
]:
task_du_result
[
id
]
=
path_result
.
get
(
id
)
for
scratch_path
in
path_result
[
'
scratch_paths
'
]:
if
scratch_du_result
:
scratch_path_du_result
=
self
.
getDiskUsageForPath
(
scratch_path
,
force_update
=
force_update
)
task_du_result
[
'
scratch_paths
'
]
=
scratch_du_result
path_du_result
[
'
scratch_paths
'
][
scratch_path
]
=
scratch_path_du_result
return
path
_du_result
return
task
_du_result
return
{
'
found
'
:
False
,
'
path
'
:
path_result
[
'
path
'
]}
return
{
'
found
'
:
False
,
'
path
'
:
path_result
[
'
path
'
]}
...
...
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