Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ycai
simbricks
Commits
472f608c
Commit
472f608c
authored
Nov 05, 2020
by
Antoine Kaufmann
Browse files
experiments: add filter option to only run subset
parent
ae40f1c2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
experiments/run.py
experiments/run.py
+13
-0
No files found.
experiments/run.py
View file @
472f608c
...
@@ -3,6 +3,7 @@ import sys
...
@@ -3,6 +3,7 @@ import sys
import
os
import
os
import
importlib
import
importlib
import
pickle
import
pickle
import
fnmatch
import
modes.experiments
as
exp
import
modes.experiments
as
exp
import
modes.runtime
as
runtime
import
modes.runtime
as
runtime
...
@@ -14,6 +15,8 @@ def mkdir_if_not_exists(path):
...
@@ -14,6 +15,8 @@ def mkdir_if_not_exists(path):
parser
=
argparse
.
ArgumentParser
()
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'experiments'
,
metavar
=
'EXP'
,
type
=
str
,
nargs
=
'+'
,
parser
.
add_argument
(
'experiments'
,
metavar
=
'EXP'
,
type
=
str
,
nargs
=
'+'
,
help
=
'An experiment file to run'
)
help
=
'An experiment file to run'
)
parser
.
add_argument
(
'--filter'
,
metavar
=
'PATTERN'
,
type
=
str
,
nargs
=
'+'
,
help
=
'Pattern to match experiment names against'
)
parser
.
add_argument
(
'--pickled'
,
action
=
'store_const'
,
const
=
True
,
parser
.
add_argument
(
'--pickled'
,
action
=
'store_const'
,
const
=
True
,
default
=
False
,
default
=
False
,
help
=
'Read exp files as pickled runs instead of exp.py files'
)
help
=
'Read exp files as pickled runs instead of exp.py files'
)
...
@@ -96,6 +99,16 @@ if not args.pickled:
...
@@ -96,6 +99,16 @@ if not args.pickled:
experiments
+=
mod
.
experiments
experiments
+=
mod
.
experiments
for
e
in
experiments
:
for
e
in
experiments
:
# apply filter if any specified
if
len
(
args
.
filter
)
>
0
:
match
=
False
for
f
in
args
.
filter
:
if
fnmatch
.
fnmatch
(
e
.
name
,
f
):
match
=
True
break
if
not
match
:
continue
# if this is an experiment with a checkpoint we might have to create it
# if this is an experiment with a checkpoint we might have to create it
if
e
.
checkpoint
:
if
e
.
checkpoint
:
prereq
=
add_exp
(
e
,
0
,
None
,
True
,
False
)
prereq
=
add_exp
(
e
,
0
,
None
,
True
,
False
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment