Skip to content

Commit 3e3edab

Browse files
committed
Restructure repo as discussed in #7
1 parent 3faac94 commit 3e3edab

File tree

75 files changed

+166
-71
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+166
-71
lines changed

.gitignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
results/
2-
experiments/state/
3-
41
.ipynb_checkpoints
52

6-
inventory/aws_ec2.yml
3+
src/inventory/aws_ec2.yml
74

85
### Ansible ###
96
*.retry

ansible.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[defaults]
2-
INVENTORY = inventory
2+
INVENTORY = src/inventory
3+
DEFAULT_ROLES_PATH = src/roles:demo_project/does_config/roles
34
ANSIBLE_CALLBACKS_ENABLED = community.general.selective
45
inventory_ignore_extensions = ~, .orig, .bak, .ini, .cfg, .retry, .pyc, .pyo, .j2
56

67
ansible_ssh_common_args = '-o StrictHostKeyChecking=no -o ForwardAgent=yes'
78

8-
99
# TODO: activate / deactivate to only show the pretty log output
1010
stdout_callback = community.general.selective
File renamed without changes.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# AUTOGENERATED FROM experiments/table/{demo_exp1, demo_exp2}.yml WITH build_config_product(...)
2+
3+
# TODO [nku] needs to be updated
4+
5+
demo_exp1:
6+
n_repetitions: 2
7+
common_roles:
8+
- setup-common
9+
host_types:
10+
client:
11+
n: 1
12+
init_role: setup-client
13+
server:
14+
n: 1
15+
check_status: false
16+
init_role: setup-server
17+
base_experiment:
18+
w: 13
19+
x: $FACTOR$
20+
host_vars:
21+
client:
22+
y: abc
23+
server:
24+
z: $FACTOR$
25+
factor_levels:
26+
- x: 4
27+
host_vars:
28+
server:
29+
z: 1
30+
31+
32+
demo_exp2:
33+
n_repetitions: 2
34+
common_roles:
35+
- setup-common
36+
host_types:
37+
client:
38+
n: 1
39+
init_role: setup-client
40+
server:
41+
n: 1
42+
init_role: setup-server
43+
base_experiment:
44+
$CMD$: echo hello [% my_run.a %]
45+
a: 10
46+
b: info
47+
c: $FACTOR$
48+
d: $FACTOR$
49+
host_vars:
50+
client:
51+
e: $FACTOR$
52+
test:
53+
f: cinfo
54+
server:
55+
g: ginfo
56+
factor_levels:
57+
- c: 1
58+
d: 4
59+
host_vars:
60+
client:
61+
e: V1
62+
- c: 1
63+
d: 4
64+
host_vars:
65+
client:
66+
e: V2
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# AUTOGENERATED FROM experiments/table/{simple}.yml WITH build_config_product(...)
2+
3+
# TODO [nku] needs to be updated
4+
5+
6+
simple:
7+
n_repetitions: 2
8+
common_roles:
9+
- setup-common
10+
host_types:
11+
single:
12+
n: 1
13+
base_experiment:
14+
seed: 1234
15+
payload_size_mb: $FACTOR$
16+
opt: $FACTOR$
17+
factor_levels:
18+
- payload_size_mb: 1
19+
opt: true
20+
- payload_size_mb: 1
21+
opt: false
22+
- payload_size_mb: 128
23+
opt: true
24+
- payload_size_mb: 128
25+
opt: false
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# The following files are ignored because they are generated by the repotemplate.py script.
2+
# For your own experiments, remove this .gitignore file to commit hand-written experiment configurations.
3+
all
4+
ansible_controller
5+
client
6+
server
7+
simple
File renamed without changes.
File renamed without changes.

roles/ansible-controller-clear/tasks/main.yml

Lines changed: 0 additions & 46 deletions
This file was deleted.
File renamed without changes.

clear.yml renamed to src/clear.yml

File renamed without changes.

experiment-suite.yml renamed to src/experiment-suite.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
---
22

3+
4+
##########################################################################
5+
# Load Experiment State and Setup AWS #
6+
##########################################################################
7+
- name: Load group_vars from non-standard location
8+
hosts: localhost
9+
10+
tasks:
11+
- include_vars: "{{ external_group_vars_dir }}/all/main.yml"
12+
313
##########################################################################
414
# Load Experiment State and Setup AWS #
515
##########################################################################
File renamed without changes.

src/group_vars/all/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
does_project_dir: "{{ lookup('env', 'DOES_PROJECT_DIR') }}"
2+
does_config_dir: "{{ does_project_dir }}/does_config"
3+
external_group_vars_dir: "{{ does_config_dir }}/group_vars"
File renamed without changes.
File renamed without changes.
File renamed without changes.

resources/repotemplate/group_vars/all/main.yml.j2 renamed to src/resources/repotemplate/group_vars/all/main.yml.j2

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ git_remote_repository: <<git_remote_repository>> # TODO: set remote repository (
1010
# The experiments are mostly run concurrently (apart from the setup and cleanup parts). Thus, the experiment with the most jobs defines the
1111
# maximal duration. But as experiments usually use fewer than 'job_n_tries' tries, an experiment with few long-running jobs can be the bottleneck too.
1212
job_n_tries: <<job_n_tries>> # should be max 1000 (otherwise playbook freezes -> unsure why)
13-
# TODO [mh]: must be tested if this is still an issue, I switched to an `until` loop
1413
job_check_wait_time: <<job_check_wait_time>>
1514

1615
remote:
@@ -19,7 +18,8 @@ remote:
1918
exp_code_dir: "{{ remote.dir }}/code"
2019

2120
local:
22-
results_dir: "./results"
21+
results_dir: "{{ does_project_dir }}/does_results"
22+
designs_dir: "{{ does_config_dir }}/designs"
2323

2424
exp_base:
2525
key_name: <<key_name>> # TODO: add key pair name
@@ -31,10 +31,3 @@ exp_base:
3131
vpc_subnet_cidr: 10.100.0.0/24
3232
sg_name: "{{ prj_id }}_sg"
3333
sg_desc: "{{ prj_id }} security group"
34-
35-
separator: '_SEP_'
36-
37-
# This prefix (incl. the capitalization) is chosen by the ec2 plugin
38-
ec2_tag_name_prefix: 'tag_Name_'
39-
ec2_tag_prj_prefix: 'tag_Prj_'
40-
ec2_tag_exp_prefix: 'tag_Exp_'
File renamed without changes.

roles/abc/tasks/main.yml renamed to src/roles/abc/tasks/main.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11

2-
32
- name: Create folder for ABC
43
ansible.builtin.file:
54
path: "{{ ABC_INSTALL_PATH }}"
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
3+
- name: Collect info about running ec2 instances
4+
community.aws.ec2_instance_info:
5+
region: "{{ exp_base.aws_region }}"
6+
filters:
7+
"tag:name": "{{ ansible_controller }}"
8+
register: ec2_instance_info
9+
10+
# TODO: remove
11+
- debug:
12+
msg: "ec2_instance_info: {{ ec2_instance_info }}"
13+
14+
- name: Extract instance ids of ec2 instances to remove
15+
ansible.builtin.set_fact:
16+
ec2_instance_ids: "{{ ec2_instance_info | json_query('*.instances[*].instance_id') | list | flatten }}"
17+
18+
# TODO: remove
19+
- debug:
20+
msg: "ec2_instance_ids: {{ ec2_instance_ids }}"
21+
22+
- ansible.builtin.pause:
23+
seconds: 10
24+
prompt: |
25+
"Removing instances with the following ids:
26+
{{ ec2_instance_ids }}
27+
28+
If the above instance IDs are wrong, abort now! (CTRL+C followed by 'A')"
29+
tags: [print_action]
30+
31+
- name: Cleanup AWS
32+
community.aws.ec2_instance:
33+
instance_ids: "{{ ec2_instance_ids }}"
34+
region: "{{ exp_base.aws_region }}"
35+
state: absent
36+
when: (ec2_instance_ids | length) > 0
37+
38+
- name: Remove AWS VPC
39+
ansible.builtin.include_role:
40+
name: suite-aws-vpc-delete

roles/experiment-job/tasks/main.yml renamed to src/roles/experiment-job/tasks/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@
131131
cmd: "{{ job.exp_run_cmd }}"
132132
cmd_label: "{{ job.job_info | to_json | string }}"
133133
cmd_working_dir: "{{ job.exp_working_dir }}"
134-
cmd_stdout_file: results/stdout.log # relative path compared to working dir
135-
cmd_stderr_file: results/stderr.log
134+
cmd_stdout_file: "{{ local.results_dir }}/stdout.log" # relative path compared to working dir
135+
cmd_stderr_file: "{{ local.results_dir }}/stderr.log"
136136
delegate_to: "{{ job.host_info.public_dns_name }}"
137137
loop: "{{ exp_jobs_to_enqueue }}"
138138
loop_control:
@@ -286,4 +286,4 @@
286286
msg: "{{ suite_progress_info[item] }}"
287287
loop: "{{ suite_progress_info.keys() | sort }}"
288288
tags: [print_action]
289-
# TEMPORARY END
289+
# TEMPORARY END
File renamed without changes.
File renamed without changes.
File renamed without changes.

roles/suite-aws-ec2-create/tasks/main.yml renamed to src/roles/suite-aws-ec2-create/tasks/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
block:
1818
- name: Loop over different host types and load group vars from file.
1919
include_vars:
20-
file: "group_vars/{{ host_type }}/main.yml"
20+
file: "{{ external_group_vars_dir }}/{{ host_type }}/main.yml"
2121
name: host_type_specific_vars
2222
loop: "{{ host_types.keys() }}"
2323
loop_control:

roles/suite-load-pre-aws/tasks/main.yml renamed to src/roles/suite-load-pre-aws/tasks/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181

8282
- name: validate the suite design and set default values
8383
suite_design_validate:
84-
src: experiments/designs/{{ suite }}.yml
84+
src: "{{ local.designs_dir }}/{{ suite }}.yml"
8585
dest: "{{ suite_design_dir }}/suite_design.yml"
8686
when: id == 'new' # only validate and resolve defaults for new (otherwise load the old already checked version)
8787

scripts/expdesign.py renamed to src/scripts/expdesign.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def main():
1010

1111
parser.add_argument('--exps', help='experiment name(s) (experiment file name without .yml ending)', nargs="+", type=str, required=True)
1212

13-
parser.add_argument('--inputdir', help='path to folder of experiment in "table" form', type=str, default="experiments/table")
13+
parser.add_argument('--inputdir', help='path to folder of experiment in "table" form', type=str, default="does_config/table")
1414

1515
parser.add_argument('--outpath', help='output path for generated of experiment in "design" form', type=str)
1616

@@ -25,7 +25,7 @@ def main():
2525
suite = exps[0]
2626

2727
if not outpath:
28-
outpath = f"experiments/designs/{suite}.yml"
28+
outpath = f"does_config/designs/{suite}.yml"
2929

3030
with open(outpath, 'w') as out_fp:
3131
print(f"Writing experiment design to: {outpath}\n")

scripts/repotemplate.py renamed to src/scripts/repotemplate.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99

1010
DEFAULT_HOST_TYPE = "host_type"
1111

12-
vars_base_path = "group_vars"
13-
templates_base_path = "resources/repotemplate/group_vars"
12+
vars_base_path = os.environ["DOES_PROJECT_FOLDER"] + "/does_config/group_vars"
13+
src_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
14+
templates_base_path = src_path + "/resources/repotemplate/group_vars"
1415
groups = ["all", "server", "client", "ansible_controller"]
1516
template_name = "main.yml.j2"
1617
# The template path is assumed to be: f"{templates_base_path}/<<NAME>>", where
File renamed without changes.

0 commit comments

Comments
 (0)