Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.bio.base
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
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
bob
bob.bio.base
Commits
3a0c97e7
There was a problem fetching the pipeline summary.
Commit
3a0c97e7
authored
7 years ago
by
Manuel Günther
Browse files
Options
Downloads
Patches
Plain Diff
Deleting partially concatenated score file when failing.
parent
108937c2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!107
Deleting partially concatenated score file when failing.
Pipeline
#
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/bio/base/tools/scoring.py
+29
-15
29 additions, 15 deletions
bob/bio/base/tools/scoring.py
with
29 additions
and
15 deletions
bob/bio/base/tools/scoring.py
+
29
−
15
View file @
3a0c97e7
...
...
@@ -98,6 +98,13 @@ def _close_written(score_file, f, write_compressed):
# close the file
f
.
close
()
def
_delete
(
score_file
,
write_compressed
):
"""
Deletes the (compressed) score_file
"""
if
write_compressed
:
score_file
+=
'
.tar.bz2
'
if
os
.
path
.
isfile
(
score_file
):
os
.
remove
(
score_file
)
def
_save_scores
(
score_file
,
scores
,
probe_objects
,
client_id
,
write_compressed
):
"""
Saves the scores of one model into a text file that can be interpreted by :py:func:`bob.measure.load.split_four_column`.
"""
...
...
@@ -441,22 +448,29 @@ def zt_norm(groups = ['dev', 'eval'], write_compressed = False, allow_missing_fi
def
_concat
(
score_files
,
output
,
write_compressed
,
model_ids
):
"""
Concatenates a list of score files into a single score file.
"""
f
=
_open_to_write
(
output
,
write_compressed
)
# Concatenates the scores
if
model_ids
is
None
:
for
score_file
in
score_files
:
i
=
_open_to_read
(
score_file
)
f
.
write
(
i
.
read
())
try
:
f
=
_open_to_write
(
output
,
write_compressed
)
# Concatenates the scores
if
model_ids
is
None
:
for
score_file
in
score_files
:
i
=
_open_to_read
(
score_file
)
f
.
write
(
i
.
read
())
else
:
for
score_file
,
model_id
in
zip
(
score_files
,
model_ids
):
i
=
_open_to_read
(
score_file
)
for
l
in
i
:
s
=
l
.
split
()
s
.
insert
(
1
,
str
(
model_id
))
f
.
write
(
"
"
.
join
(
s
)
+
"
\n
"
)
except
:
logger
.
error
(
"
Concatenation failed; removing result file %s
"
,
output
)
_close_written
(
output
,
f
,
write_compressed
)
_delete
(
output
,
write_compressed
)
raise
else
:
for
score_file
,
model_id
in
zip
(
score_files
,
model_ids
):
i
=
_open_to_read
(
score_file
)
for
l
in
i
:
s
=
l
.
split
()
s
.
insert
(
1
,
str
(
model_id
))
f
.
write
(
"
"
.
join
(
s
)
+
"
\n
"
)
_close_written
(
output
,
f
,
write_compressed
)
_close_written
(
output
,
f
,
write_compressed
)
...
...
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