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
ce80e459
Commit
ce80e459
authored
4 years ago
by
Björn Vonheiden
Browse files
Options
Downloads
Patches
Plain Diff
Put theodolite py program into functions
parent
fa6d70fa
No related branches found
No related tags found
1 merge request
!44
Enhanced CLI arguments for theodolite
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
execution/theodolite.py
+137
-125
137 additions, 125 deletions
execution/theodolite.py
with
137 additions
and
125 deletions
execution/theodolite.py
+
137
−
125
View file @
ce80e459
#!/usr/bin/env python
import
sys
import
logging
# logging
import
os
import
sys
from
strategies.config
import
ExperimentConfig
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
...
...
@@ -12,133 +13,144 @@ from strategies.experiment_execution import ExperimentExecutor
import
strategies.subexperiment_execution.subexperiment_executor
as
subexperiment_executor
import
strategies.subexperiment_evaluation.subexperiment_evaluator
as
subexperiment_evaluator
uc
=
sys
.
argv
[
1
]
dim_values
=
sys
.
argv
[
2
].
split
(
'
,
'
)
replicas
=
sys
.
argv
[
3
].
split
(
'
,
'
)
partitions
=
sys
.
argv
[
4
]
if
len
(
sys
.
argv
)
>=
5
and
sys
.
argv
[
4
]
else
40
cpu_limit
=
sys
.
argv
[
5
]
if
len
(
sys
.
argv
)
>=
6
and
sys
.
argv
[
5
]
else
"
1000m
"
memory_limit
=
sys
.
argv
[
6
]
if
len
(
sys
.
argv
)
>=
7
and
sys
.
argv
[
6
]
else
"
4Gi
"
kafka_streams_commit_interval_ms
=
sys
.
argv
[
7
]
if
len
(
sys
.
argv
)
>=
8
and
sys
.
argv
[
7
]
else
100
execution_minutes
=
sys
.
argv
[
8
]
if
len
(
sys
.
argv
)
>=
9
and
sys
.
argv
[
8
]
else
5
domain_restriction
=
bool
(
sys
.
argv
[
9
])
if
len
(
sys
.
argv
)
>=
10
and
sys
.
argv
[
9
]
==
"
restrict-domain
"
else
False
search_strategy
=
sys
.
argv
[
10
]
if
len
(
sys
.
argv
)
>=
11
and
(
sys
.
argv
[
10
]
==
"
linear-search
"
or
sys
.
argv
[
10
]
==
"
binary-search
"
)
else
"
default
"
print
(
f
"
Domain restriction of search space activated:
{
domain_restriction
}
"
)
print
(
f
"
Chosen search strategy:
{
search_strategy
}
"
)
def
main
():
uc
=
sys
.
argv
[
1
]
dim_values
=
sys
.
argv
[
2
].
split
(
'
,
'
)
replicas
=
sys
.
argv
[
3
].
split
(
'
,
'
)
partitions
=
sys
.
argv
[
4
]
if
len
(
sys
.
argv
)
>=
5
and
sys
.
argv
[
4
]
else
40
cpu_limit
=
sys
.
argv
[
5
]
if
len
(
sys
.
argv
)
>=
6
and
sys
.
argv
[
5
]
else
"
1000m
"
memory_limit
=
sys
.
argv
[
6
]
if
len
(
sys
.
argv
)
>=
7
and
sys
.
argv
[
6
]
else
"
4Gi
"
kafka_streams_commit_interval_ms
=
sys
.
argv
[
7
]
if
len
(
sys
.
argv
)
>=
8
and
sys
.
argv
[
7
]
else
100
execution_minutes
=
sys
.
argv
[
8
]
if
len
(
sys
.
argv
)
>=
9
and
sys
.
argv
[
8
]
else
5
domain_restriction
=
bool
(
sys
.
argv
[
9
])
if
len
(
sys
.
argv
)
>=
10
and
sys
.
argv
[
9
]
==
"
restrict-domain
"
else
False
search_strategy
=
sys
.
argv
[
10
]
if
len
(
sys
.
argv
)
>=
11
and
(
sys
.
argv
[
10
]
==
"
linear-search
"
or
sys
.
argv
[
10
]
==
"
binary-search
"
)
else
"
default
"
if
os
.
path
.
exists
(
"
exp_counter.txt
"
):
with
open
(
"
exp_counter.txt
"
,
mode
=
"
r
"
)
as
read_stream
:
exp_id
=
int
(
read_stream
.
read
())
else
:
exp_id
=
0
print
(
f
"
Domain restriction of search space activated:
{
domain_restriction
}
"
)
print
(
f
"
Chosen search strategy:
{
search_strategy
}
"
)
with
open
(
"
exp_counter.txt
"
,
mode
=
"
w
"
)
as
write_stream
:
write_stream
.
write
(
str
(
exp_id
+
1
))
# domain restriction
if
domain_restriction
:
# domain restriction + linear-search
if
search_strategy
==
"
linear-search
"
:
print
(
f
"
Going to execute at most
{
len
(
dim_values
)
+
len
(
replicas
)
-
1
}
subexperiments in total..
"
)
experiment_config
=
ExperimentConfig
(
use_case
=
uc
,
exp_id
=
exp_id
,
dim_values
=
dim_values
,
replicass
=
replicas
,
partitions
=
partitions
,
cpu_limit
=
cpu_limit
,
memory_limit
=
memory_limit
,
kafka_streams_commit_interval_ms
=
kafka_streams_commit_interval_ms
,
execution_minutes
=
execution_minutes
,
domain_restriction_strategy
=
lower_bound_strategy
,
search_strategy
=
linear_search_strategy
,
subexperiment_executor
=
subexperiment_executor
,
subexperiment_evaluator
=
subexperiment_evaluator
)
# domain restriction + binary-search
elif
search_strategy
==
"
binary-search
"
:
experiment_config
=
ExperimentConfig
(
use_case
=
uc
,
exp_id
=
exp_id
,
dim_values
=
dim_values
,
replicass
=
replicas
,
partitions
=
partitions
,
cpu_limit
=
cpu_limit
,
memory_limit
=
memory_limit
,
kafka_streams_commit_interval_ms
=
kafka_streams_commit_interval_ms
,
execution_minutes
=
execution_minutes
,
domain_restriction_strategy
=
lower_bound_strategy
,
search_strategy
=
binary_search_strategy
,
subexperiment_executor
=
subexperiment_executor
,
subexperiment_evaluator
=
subexperiment_evaluator
)
# domain restriction + check_all
if
os
.
path
.
exists
(
"
exp_counter.txt
"
):
with
open
(
"
exp_counter.txt
"
,
mode
=
"
r
"
)
as
read_stream
:
exp_id
=
int
(
read_stream
.
read
())
else
:
print
(
f
"
Going to execute
{
len
(
dim_values
)
*
len
(
replicas
)
}
subexperiments in total..
"
)
experiment_config
=
ExperimentConfig
(
use_case
=
uc
,
exp_id
=
exp_id
,
dim_values
=
dim_values
,
replicass
=
replicas
,
partitions
=
partitions
,
cpu_limit
=
cpu_limit
,
memory_limit
=
memory_limit
,
kafka_streams_commit_interval_ms
=
kafka_streams_commit_interval_ms
,
execution_minutes
=
execution_minutes
,
domain_restriction_strategy
=
lower_bound_strategy
,
search_strategy
=
check_all_strategy
,
subexperiment_executor
=
subexperiment_executor
,
subexperiment_evaluator
=
subexperiment_evaluator
)
# no domain restriction
else
:
# no domain restriction + linear-search
if
search_strategy
==
"
linear-search
"
:
print
(
f
"
Going to execute at most
{
len
(
dim_values
)
*
len
(
replicas
)
}
subexperiments in total..
"
)
experiment_config
=
ExperimentConfig
(
use_case
=
uc
,
exp_id
=
exp_id
,
dim_values
=
dim_values
,
replicass
=
replicas
,
partitions
=
partitions
,
cpu_limit
=
cpu_limit
,
memory_limit
=
memory_limit
,
kafka_streams_commit_interval_ms
=
kafka_streams_commit_interval_ms
,
execution_minutes
=
execution_minutes
,
domain_restriction_strategy
=
no_lower_bound_strategy
,
search_strategy
=
linear_search_strategy
,
subexperiment_executor
=
subexperiment_executor
,
subexperiment_evaluator
=
subexperiment_evaluator
)
# no domain restriction + binary-search
elif
search_strategy
==
"
binary-search
"
:
experiment_config
=
ExperimentConfig
(
use_case
=
uc
,
exp_id
=
exp_id
,
dim_values
=
dim_values
,
replicass
=
replicas
,
partitions
=
partitions
,
cpu_limit
=
cpu_limit
,
memory_limit
=
memory_limit
,
kafka_streams_commit_interval_ms
=
kafka_streams_commit_interval_ms
,
execution_minutes
=
execution_minutes
,
domain_restriction_strategy
=
no_lower_bound_strategy
,
search_strategy
=
binary_search_strategy
,
subexperiment_executor
=
subexperiment_executor
,
subexperiment_evaluator
=
subexperiment_evaluator
)
# no domain restriction + check_all
exp_id
=
0
with
open
(
"
exp_counter.txt
"
,
mode
=
"
w
"
)
as
write_stream
:
write_stream
.
write
(
str
(
exp_id
+
1
))
# domain restriction
if
domain_restriction
:
# domain restriction + linear-search
if
search_strategy
==
"
linear-search
"
:
print
(
f
"
Going to execute at most
{
len
(
dim_values
)
+
len
(
replicas
)
-
1
}
subexperiments in total..
"
)
experiment_config
=
ExperimentConfig
(
use_case
=
uc
,
exp_id
=
exp_id
,
dim_values
=
dim_values
,
replicass
=
replicas
,
partitions
=
partitions
,
cpu_limit
=
cpu_limit
,
memory_limit
=
memory_limit
,
kafka_streams_commit_interval_ms
=
kafka_streams_commit_interval_ms
,
execution_minutes
=
execution_minutes
,
domain_restriction_strategy
=
lower_bound_strategy
,
search_strategy
=
linear_search_strategy
,
subexperiment_executor
=
subexperiment_executor
,
subexperiment_evaluator
=
subexperiment_evaluator
)
# domain restriction + binary-search
elif
search_strategy
==
"
binary-search
"
:
experiment_config
=
ExperimentConfig
(
use_case
=
uc
,
exp_id
=
exp_id
,
dim_values
=
dim_values
,
replicass
=
replicas
,
partitions
=
partitions
,
cpu_limit
=
cpu_limit
,
memory_limit
=
memory_limit
,
kafka_streams_commit_interval_ms
=
kafka_streams_commit_interval_ms
,
execution_minutes
=
execution_minutes
,
domain_restriction_strategy
=
lower_bound_strategy
,
search_strategy
=
binary_search_strategy
,
subexperiment_executor
=
subexperiment_executor
,
subexperiment_evaluator
=
subexperiment_evaluator
)
# domain restriction + check_all
else
:
print
(
f
"
Going to execute
{
len
(
dim_values
)
*
len
(
replicas
)
}
subexperiments in total..
"
)
experiment_config
=
ExperimentConfig
(
use_case
=
uc
,
exp_id
=
exp_id
,
dim_values
=
dim_values
,
replicass
=
replicas
,
partitions
=
partitions
,
cpu_limit
=
cpu_limit
,
memory_limit
=
memory_limit
,
kafka_streams_commit_interval_ms
=
kafka_streams_commit_interval_ms
,
execution_minutes
=
execution_minutes
,
domain_restriction_strategy
=
lower_bound_strategy
,
search_strategy
=
check_all_strategy
,
subexperiment_executor
=
subexperiment_executor
,
subexperiment_evaluator
=
subexperiment_evaluator
)
# no domain restriction
else
:
print
(
f
"
Going to execute
{
len
(
dim_values
)
*
len
(
replicas
)
}
subexperiments in total..
"
)
experiment_config
=
ExperimentConfig
(
use_case
=
uc
,
exp_id
=
exp_id
,
dim_values
=
dim_values
,
replicass
=
replicas
,
partitions
=
partitions
,
cpu_limit
=
cpu_limit
,
memory_limit
=
memory_limit
,
kafka_streams_commit_interval_ms
=
kafka_streams_commit_interval_ms
,
execution_minutes
=
execution_minutes
,
domain_restriction_strategy
=
no_lower_bound_strategy
,
search_strategy
=
check_all_strategy
,
subexperiment_executor
=
subexperiment_executor
,
subexperiment_evaluator
=
subexperiment_evaluator
)
# no domain restriction + linear-search
if
search_strategy
==
"
linear-search
"
:
print
(
f
"
Going to execute at most
{
len
(
dim_values
)
*
len
(
replicas
)
}
subexperiments in total..
"
)
experiment_config
=
ExperimentConfig
(
use_case
=
uc
,
exp_id
=
exp_id
,
dim_values
=
dim_values
,
replicass
=
replicas
,
partitions
=
partitions
,
cpu_limit
=
cpu_limit
,
memory_limit
=
memory_limit
,
kafka_streams_commit_interval_ms
=
kafka_streams_commit_interval_ms
,
execution_minutes
=
execution_minutes
,
domain_restriction_strategy
=
no_lower_bound_strategy
,
search_strategy
=
linear_search_strategy
,
subexperiment_executor
=
subexperiment_executor
,
subexperiment_evaluator
=
subexperiment_evaluator
)
# no domain restriction + binary-search
elif
search_strategy
==
"
binary-search
"
:
experiment_config
=
ExperimentConfig
(
use_case
=
uc
,
exp_id
=
exp_id
,
dim_values
=
dim_values
,
replicass
=
replicas
,
partitions
=
partitions
,
cpu_limit
=
cpu_limit
,
memory_limit
=
memory_limit
,
kafka_streams_commit_interval_ms
=
kafka_streams_commit_interval_ms
,
execution_minutes
=
execution_minutes
,
domain_restriction_strategy
=
no_lower_bound_strategy
,
search_strategy
=
binary_search_strategy
,
subexperiment_executor
=
subexperiment_executor
,
subexperiment_evaluator
=
subexperiment_evaluator
)
# no domain restriction + check_all
else
:
print
(
f
"
Going to execute
{
len
(
dim_values
)
*
len
(
replicas
)
}
subexperiments in total..
"
)
experiment_config
=
ExperimentConfig
(
use_case
=
uc
,
exp_id
=
exp_id
,
dim_values
=
dim_values
,
replicass
=
replicas
,
partitions
=
partitions
,
cpu_limit
=
cpu_limit
,
memory_limit
=
memory_limit
,
kafka_streams_commit_interval_ms
=
kafka_streams_commit_interval_ms
,
execution_minutes
=
execution_minutes
,
domain_restriction_strategy
=
no_lower_bound_strategy
,
search_strategy
=
check_all_strategy
,
subexperiment_executor
=
subexperiment_executor
,
subexperiment_evaluator
=
subexperiment_evaluator
)
executor
=
ExperimentExecutor
(
experiment_config
)
executor
.
execute
()
executor
=
ExperimentExecutor
(
experiment_config
)
executor
.
execute
()
\ No newline at end of file
if
__name__
==
'
__main__
'
:
logging
.
basicConfig
(
level
=
logging
.
INFO
)
main
()
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