Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
trainbenchmark
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Jesper
trainbenchmark
Commits
af53be9f
Commit
af53be9f
authored
6 years ago
by
René Schöne
Browse files
Options
Downloads
Patches
Plain Diff
Fix off-by-one error in merge_results
parent
b869dca6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
trainbenchmark/trainbenchmark-reporting/merge_results.py
+9
-13
9 additions, 13 deletions
trainbenchmark/trainbenchmark-reporting/merge_results.py
with
9 additions
and
13 deletions
trainbenchmark/trainbenchmark-reporting/merge_results.py
+
9
−
13
View file @
af53be9f
#!/usr/bin/env python
import
argparse
import
csv
import
glob
import
json
import
logging
...
...
@@ -51,11 +50,11 @@ def include_file_config(args):
def
create_link
(
fileToLink
,
linkName
,
dry_run
):
(
logger
.
info
if
args
.
dry_run
else
logger
.
debug
)(
'
Linking %s to %s
'
,
fileToLink
,
linkName
)
if
dry_run
:
return
if
os
.
path
.
lexists
(
linkName
):
os
.
unlink
(
linkName
)
(
logger
.
info
if
args
.
dry_run
else
logger
.
debug
)(
'
Linking %s to %s
'
,
fileToLink
,
linkName
)
os
.
symlink
(
fileToLink
,
linkName
)
...
...
@@ -89,6 +88,10 @@ def copy_replace(fileTocopy, all_runs_dir, tool_name, run, dry_run):
run_name
=
new_run_name
(
run
)
targetFile
=
os
.
path
.
join
(
all_runs_dir
,
os
.
path
.
basename
(
fileTocopy
).
replace
(
tool_name
,
run_name
))
if
dry_run
:
logger
.
info
(
'
Would copy
"
%s
"
to
"
%s
"'
,
fileTocopy
,
targetFile
)
return
logger
.
debug
(
'
Copying
"
%s
"
to
"
%s
"'
,
fileTocopy
,
targetFile
)
first
=
True
with
open
(
fileTocopy
)
as
fdr_source
,
open
(
targetFile
,
'
w
'
)
as
fdr_target
:
for
line
in
fdr_source
:
...
...
@@ -130,15 +133,8 @@ def main(args):
for
dir_name
in
(
merged_dir
,
merged_dir_benchmark
,
merged_dir_individual
):
ensure_directory
(
dir_name
,
args
.
dry_run
)
# Gathering tools
tools
=
[]
reader
=
csv
.
reader
(
args
.
tools
)
next
(
reader
)
for
row
in
reader
:
if
not
row
:
continue
tools
.
append
(
row
[
0
])
logger
.
debug
(
'
result_dir: %s, tools: %s
'
,
result_dir
,
tools
)
# Using tools from config
logger
.
debug
(
'
result_dir: %s, tools: %s
'
,
result_dir
,
args
.
tools
)
# Clean symlinks if requested or max_size is set
if
(
args
.
clean
or
args
.
max_size
)
and
not
args
.
dry_run
:
...
...
@@ -152,7 +148,7 @@ def main(args):
os
.
remove
(
linkName
)
# Merge results
for
tool
in
tools
:
for
tool
in
args
.
tools
:
if
tool
.
startswith
(
'
#
'
):
logger
.
debug
(
'
Ignoring tool
"
%s
"'
,
tool
[
1
:])
continue
...
...
@@ -182,7 +178,7 @@ def main(args):
ensure_directory
(
global_run_dir
,
args
.
dry_run
)
for
csvFile
in
os
.
listdir
(
run_dir
):
# link file in run directory
fileToLink
=
os
.
path
.
join
(
tool_dir
,
run
,
csvFile
)
fileToLink
=
os
.
path
.
join
(
run_dir
,
csvFile
)
linkName
=
os
.
path
.
join
(
global_run_dir
,
csvFile
)
create_link
(
fileToLink
,
linkName
,
args
.
dry_run
)
# skip if max-size is set and size is exceeded
...
...
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