Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scikit-luc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
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
Luc Giffon
scikit-luc
Commits
7707a0f8
Commit
7707a0f8
authored
6 years ago
by
Luc Giffon
Browse files
Options
Downloads
Patches
Plain Diff
add check_stderr script + exemple de pattern pour trouver la ligne de commande
parent
ee8d22b6
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
skluc/main/tools/experiences/check_stderr.py
+40
-4
40 additions, 4 deletions
skluc/main/tools/experiences/check_stderr.py
skluc/main/tools/experiences/cmd_line_pattern_ex.txt
+1
-0
1 addition, 0 deletions
skluc/main/tools/experiences/cmd_line_pattern_ex.txt
with
41 additions
and
4 deletions
skluc/main/tools/experiences/check_stderr.py
+
40
−
4
View file @
7707a0f8
"""
check_stderr: Gather errors of OAR experiments in one file.zipfile.BadZipFile: Bad CRC-32
Usage:
check_stderr -i IPATH [-p regex] [-P str] [--header] [--verbose] [--commands str]
Options:
-h --help Show this screen.
-i --input-dir=<IPATH> Input directory wher to find results
-p --patern=regex Specify the pattern of the files to be looked at [default: (.+)_stdout.txt].
-P --patern-error=regex Specify the pattern of the error files to be looked at [default: _stderr.txt].
-r --header Says if there is a header in the result files.
-c --commands=str Write a file containg the command lines arguments for the scripts that have led to an error
-v --verbose Print the lines of the final file
"""
import
re
import
os
from
os
import
walk
from
os.path
import
isfile
,
join
import
docopt
if
__name__
==
"
__main__
"
:
path
=
"
/home/luc/Resultats/Deepstrom/september_2018/deepfried_rel
"
arguments
=
docopt
.
docopt
(
__doc__
)
pattern
=
arguments
[
"
--patern
"
]
pattern_err
=
arguments
[
"
--patern-error
"
]
pattern_cmd
=
arguments
[
"
--commands
"
]
path
=
os
.
path
.
abspath
(
arguments
[
"
--input-dir
"
])
onlyfiles
=
[]
for
dirpath
,
dirnames
,
filenames
in
walk
(
path
):
onlyfiles
.
extend
([
join
(
dirpath
,
f
)
for
f
in
filenames
if
isfile
(
join
(
dirpath
,
f
))])
pattern
=
"
(.+)_stdout.txt
"
compiled_re
=
re
.
compile
(
pattern
)
if
pattern_cmd
is
not
None
:
compiled_re_cmd
=
re
.
compile
(
pattern_cmd
)
errors
=
[]
command_lines
=
[]
for
f_name
in
onlyfiles
:
if
not
compiled_re
.
match
(
f_name
):
continue
...
...
@@ -21,12 +47,22 @@ if __name__ == "__main__":
if
str_f
==
""
:
f_name_split
=
f_name
.
split
(
"
_
"
)
f_name_base
=
"
_
"
.
join
(
f_name_split
[:
-
1
])
f_name_err
=
f_name_base
+
"
_stderr.txt
"
f_name_err
=
f_name_base
+
pattern_err
with
open
(
f_name_err
,
'
r
'
)
as
ferr
:
str_ferr
=
ferr
.
read
().
strip
()
errors
.
append
(
str_ferr
)
if
pattern_cmd
is
not
None
:
match
=
compiled_re_cmd
.
search
(
str_ferr
)
str_match
=
match
.
group
(
1
).
strip
()
command_lines
.
append
(
str_match
)
with
open
(
join
(
path
,
"
errors.txt
"
),
'
w
'
)
as
f_out_err
:
for
err
in
errors
:
f_out_err
.
write
(
err
)
f_out_err
.
write
(
"
\n\n\n\n
"
)
if
pattern_cmd
is
not
None
:
with
open
(
join
(
path
,
"
array_param_cmd_errors.txt
"
),
'
w
'
)
as
f_out_cmd_err
:
for
cmd
in
command_lines
:
f_out_cmd_err
.
write
(
cmd
)
f_out_cmd_err
.
write
(
"
\n
"
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
skluc/main/tools/experiences/cmd_line_pattern_ex.txt
0 → 100644
+
1
−
0
View file @
7707a0f8
Command line:\s.+\.py\s(.+)\n
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