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
8d116803
Commit
8d116803
authored
4 years ago
by
Björn Vonheiden
Browse files
Options
Downloads
Patches
Plain Diff
Add module for cli parsing
parent
e036e5e5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!44
Enhanced CLI arguments for theodolite
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
execution/strategies/cli_parser.py
+69
-0
69 additions, 0 deletions
execution/strategies/cli_parser.py
execution/theodolite.py
+2
-53
2 additions, 53 deletions
execution/theodolite.py
with
71 additions
and
53 deletions
execution/strategies/cli_parser.py
0 → 100644
+
69
−
0
View file @
8d116803
import
argparse
def
default_parser
(
description
):
"""
Returns the default parser that can be used for thodolite and run uc py
:param description: The description the argument parser should show.
"""
parser
=
argparse
.
ArgumentParser
(
description
=
description
)
parser
.
add_argument
(
'
uc
'
,
metavar
=
'
<uc>
'
,
help
=
'
use case number, one of 1, 2, 3 or 4
'
)
parser
.
add_argument
(
'
--partitions
'
,
'
-p
'
,
default
=
40
,
type
=
int
,
metavar
=
'
<partitions>
'
,
help
=
'
Number of partitions for Kafka topics
'
)
parser
.
add_argument
(
'
--cpu-limit
'
,
'
-cpu
'
,
default
=
'
1000m
'
,
metavar
=
'
<CPU limit>
'
,
help
=
'
Kubernetes CPU limit
'
)
parser
.
add_argument
(
'
--memory-limit
'
,
'
-mem
'
,
default
=
'
4Gi
'
,
metavar
=
'
<memory limit>
'
,
help
=
'
Kubernetes memory limit
'
)
parser
.
add_argument
(
'
--commit-ms
'
,
default
=
100
,
type
=
int
,
metavar
=
'
<commit ms>
'
,
help
=
'
Kafka Streams commit interval in milliseconds
'
)
parser
.
add_argument
(
'
--duration
'
,
'
-d
'
,
default
=
5
,
type
=
int
,
metavar
=
'
<duration>
'
,
help
=
'
Duration in minutes subexperiments should be
\
executed for
'
)
parser
.
add_argument
(
'
--reset
'
,
action
=
"
store_true
"
,
help
=
'
Resets the environment before execution
'
)
parser
.
add_argument
(
'
--reset-only
'
,
action
=
"
store_true
"
,
help
=
'
Only resets the environment. Ignores all other parameters
'
)
return
parser
def
benchmark_parser
(
description
):
"""
Parser for the overall benchmark execution
"""
parser
=
default_parser
(
description
)
parser
.
add_argument
(
'
loads
'
,
type
=
int
,
metavar
=
'
<load>
'
,
nargs
=
'
+
'
,
help
=
'
Loads that should be executed
'
)
parser
.
add_argument
(
'
--instances
'
,
'
-i
'
,
dest
=
'
instances_list
'
,
default
=
[
1
],
type
=
int
,
metavar
=
'
<instance>
'
,
nargs
=
'
+
'
,
help
=
'
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>
'
,
help
=
'
The benchmarking search strategy. Can be set to default, linear-search or binary-search
'
)
return
parser
This diff is collapsed.
Click to expand it.
execution/theodolite.py
+
2
−
53
View file @
8d116803
...
...
@@ -5,6 +5,7 @@ import logging # logging
import
os
import
sys
from
strategies.config
import
ExperimentConfig
import
strategies.cli_parser
as
cli_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
...
...
@@ -18,59 +19,7 @@ import strategies.subexperiment_evaluation.subexperiment_evaluator as subexperim
def
load_variables
():
"""
Load the CLI variables given at the command line
"""
print
(
'
Load CLI variables
'
)
parser
=
argparse
.
ArgumentParser
(
description
=
'
Run use case Programm
'
)
parser
.
add_argument
(
'
uc
'
,
metavar
=
'
<uc>
'
,
help
=
'
use case number, one of 1, 2, 3 or 4
'
)
parser
.
add_argument
(
'
loads
'
,
type
=
int
,
metavar
=
'
<load>
'
,
nargs
=
'
+
'
,
help
=
'
Loads that should be executed
'
)
parser
.
add_argument
(
'
--instances
'
,
'
-i
'
,
dest
=
'
instances_list
'
,
default
=
[
1
],
type
=
int
,
metavar
=
'
<instance>
'
,
nargs
=
'
+
'
,
help
=
'
List of instances used in benchmarks
'
)
parser
.
add_argument
(
'
--partitions
'
,
'
-p
'
,
default
=
40
,
type
=
int
,
metavar
=
'
<partitions>
'
,
help
=
'
Number of partitions for Kafka topics
'
)
parser
.
add_argument
(
'
--cpu-limit
'
,
'
-cpu
'
,
default
=
'
1000m
'
,
metavar
=
'
<CPU limit>
'
,
help
=
'
Kubernetes CPU limit
'
)
parser
.
add_argument
(
'
--memory-limit
'
,
'
-mem
'
,
default
=
'
4Gi
'
,
metavar
=
'
<memory limit>
'
,
help
=
'
Kubernetes memory limit
'
)
parser
.
add_argument
(
'
--commit-ms
'
,
default
=
100
,
type
=
int
,
metavar
=
'
<commit ms>
'
,
help
=
'
Kafka Streams commit interval in milliseconds
'
)
parser
.
add_argument
(
'
--duration
'
,
'
-d
'
,
default
=
5
,
type
=
int
,
metavar
=
'
<duration>
'
,
help
=
'
Duration in minutes subexperiments should be
\
executed for
'
)
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>
'
,
help
=
'
The benchmarking search strategy. Can be set to default, linear-search or binary-search
'
)
parser
.
add_argument
(
'
--reset
'
,
action
=
"
store_true
"
,
help
=
'
Resets the environment before execution
'
)
parser
.
add_argument
(
'
--reset-only
'
,
action
=
"
store_true
"
,
help
=
'
Only resets the environment. Ignores all other parameters
'
)
parser
=
cli_parser
.
benchmark_parser
(
"
Run theodolite benchmarking
"
)
args
=
parser
.
parse_args
()
print
(
args
)
return
args
...
...
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