Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
theodolite
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
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sören Henning
theodolite
Commits
5d116fd3
Commit
5d116fd3
authored
4 years ago
by
Björn Vonheiden
Committed by
Sören Henning
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Enable load of environment variables in parser for python scripts
parent
bcdd5d63
No related branches found
No related tags found
1 merge request
!45
Run theodolite benchmarking in Kubernetes
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
execution/lib/cli_parser.py
+29
-13
29 additions, 13 deletions
execution/lib/cli_parser.py
execution/run_uc.py
+1
-1
1 addition, 1 deletion
execution/run_uc.py
execution/theodolite.py
+1
-1
1 addition, 1 deletion
execution/theodolite.py
with
31 additions
and
15 deletions
execution/
strategies
/cli_parser.py
→
execution/
lib
/cli_parser.py
+
29
−
13
View file @
5d116fd3
import
argparse
import
os
def
env_list_default
(
env
,
tf
):
"""
Makes a list from an environment string.
"""
v
=
os
.
environ
.
get
(
env
)
if
v
is
not
None
:
v
=
[
tf
(
s
)
for
s
in
v
.
split
(
'
,
'
)]
return
v
def
default_parser
(
description
):
"""
...
...
@@ -8,29 +18,30 @@ def default_parser(description):
parser
=
argparse
.
ArgumentParser
(
description
=
description
)
parser
.
add_argument
(
'
--uc
'
,
metavar
=
'
<uc>
'
,
default
=
os
.
environ
.
get
(
'
UC
'
),
help
=
'
[mandatory] use case number, one of 1, 2, 3 or 4
'
)
parser
.
add_argument
(
'
--partitions
'
,
'
-p
'
,
default
=
40
,
type
=
int
,
metavar
=
'
<partitions>
'
,
type
=
int
,
default
=
os
.
environ
.
get
(
'
PARTITIONS
'
,
40
),
help
=
'
Number of partitions for Kafka topics
'
)
parser
.
add_argument
(
'
--cpu-limit
'
,
'
-cpu
'
,
default
=
'
1000m
'
,
metavar
=
'
<CPU limit>
'
,
default
=
os
.
environ
.
get
(
'
CPU_LIMIT
'
,
'
1000m
'
),
help
=
'
Kubernetes CPU limit
'
)
parser
.
add_argument
(
'
--memory-limit
'
,
'
-mem
'
,
default
=
'
4Gi
'
,
metavar
=
'
<memory limit>
'
,
default
=
os
.
environ
.
get
(
'
MEMORY_LIMIT
'
,
'
4Gi
'
),
help
=
'
Kubernetes memory limit
'
)
parser
.
add_argument
(
'
--commit-ms
'
,
default
=
100
,
type
=
int
,
metavar
=
'
<commit ms>
'
,
type
=
int
,
default
=
os
.
environ
.
get
(
'
COMMIT_MS
'
,
100
),
help
=
'
Kafka Streams commit interval in milliseconds
'
)
parser
.
add_argument
(
'
--duration
'
,
'
-d
'
,
default
=
5
,
type
=
int
,
metavar
=
'
<duration>
'
,
type
=
int
,
default
=
os
.
environ
.
get
(
'
DURATION
'
,
5
),
help
=
'
Duration in minutes subexperiments should be
\
executed for
'
)
parser
.
add_argument
(
'
--reset
'
,
...
...
@@ -49,22 +60,24 @@ def benchmark_parser(description):
parser
=
default_parser
(
description
)
parser
.
add_argument
(
'
--loads
'
,
type
=
int
,
metavar
=
'
<load>
'
,
type
=
int
,
nargs
=
'
+
'
,
default
=
env_list_default
(
'
LOADS
'
,
int
),
help
=
'
[mandatory] Loads that should be executed
'
)
parser
.
add_argument
(
'
--instances
'
,
'
-i
'
,
dest
=
'
instances_list
'
,
type
=
int
,
metavar
=
'
<instances>
'
,
type
=
int
,
nargs
=
'
+
'
,
default
=
env_list_default
(
'
INSTANCES
'
,
int
),
help
=
'
[mandatory] List of instances used in benchmarks
'
)
parser
.
add_argument
(
'
--domain-restriction
'
,
action
=
"
store_true
"
,
help
=
'
To use domain restriction. For details see README
'
)
parser
.
add_argument
(
'
--search-strategy
'
,
default
=
'
default
'
,
metavar
=
'
<strategy>
'
,
default
=
os
.
environ
.
get
(
'
SEARCH_STRATEGY
'
,
'
default
'
),
help
=
'
The benchmarking search strategy. Can be set to default, linear-search or binary-search
'
)
return
parser
...
...
@@ -76,13 +89,16 @@ def execution_parser(description):
parser
=
default_parser
(
description
)
parser
.
add_argument
(
'
--exp-id
'
,
metavar
=
'
<exp id>
'
,
default
=
os
.
environ
.
get
(
'
EXP_ID
'
),
help
=
'
[mandatory] ID of the experiment
'
)
parser
.
add_argument
(
'
--load
'
,
type
=
int
,
metavar
=
'
<load>
'
,
type
=
int
,
default
=
os
.
environ
.
get
(
'
LOAD
'
),
help
=
'
[mandatory] Load that should be used for benchmakr
'
)
parser
.
add_argument
(
'
--instances
'
,
type
=
int
,
metavar
=
'
<instances>
'
,
type
=
int
,
default
=
os
.
environ
.
get
(
'
INSTANCES
'
),
help
=
'
[mandatory] Numbers of instances to be benchmarked
'
)
return
parser
This diff is collapsed.
Click to expand it.
execution/run_uc.py
+
1
−
1
View file @
5d116fd3
...
...
@@ -5,7 +5,7 @@ from kubernetes.stream import stream
import
lag_analysis
import
logging
# logging
from
os
import
path
# path utilities
from
strategies
.cli_parser
import
execution_parser
from
lib
.cli_parser
import
execution_parser
import
subprocess
# execute bash commands
import
sys
# for exit of program
import
time
# process sleep
...
...
This diff is collapsed.
Click to expand it.
execution/theodolite.py
+
1
−
1
View file @
5d116fd3
#!/usr/bin/env python
import
argparse
from
lib.cli_parser
import
benchmark_parser
import
logging
# logging
import
os
import
sys
from
strategies.config
import
ExperimentConfig
from
strategies.cli_parser
import
benchmark_parser
import
strategies.strategies.domain_restriction.lower_bound_strategy
as
lower_bound_strategy
import
strategies.strategies.domain_restriction.no_lower_bound_strategy
as
no_lower_bound_strategy
import
strategies.strategies.search.check_all_strategy
as
check_all_strategy
...
...
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