Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor LAMBKIN #35

Merged
merged 15 commits into from
Apr 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .ansible/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# LAMBKIN Collection for Ansible

An Ansible collection to provision a platform for `lambkin` development and usage.

## Contributing to this collection

## Tested with Ansible

Ansible 7.4.0 (ansible-core 2.14.4)

## External requirements

This collection assumes that `python3` and `pip3` are available in the remote host.

Currently, only POSIX OSes are supported. It is assumed that `sudo` is available for privilege escalation.

## Included content

### Playbooks

#### [ekumenlabs.lambkin.local_runner](playbooks/local_runner.yml)

This playbook provisions the local host to run LAMBKIN-powered benchmarks.

### Roles

#### [ekumenlabs.lambkin.runner](roles/runner)

This role provisions the remote host to run LAMBKIN-powered benchmarks.

By default, all available components are installed. These components may be explicitly included
and excluded via `include_components` and `exclude_components` (list) variables, respectively.

## Using this collection

### Installing from source

```sh
git clone https://github.com/ekumenlabs/lambkin
cd lambkin && ansible-galaxy collection install .ansible
```

### Provisioning local host

```sh
ansible-playbook ekumenlabs.lambkin.local_runner
```

## More information

- [Ansible Collection overview](https://github.com/ansible-collections/overview)
- [Ansible User guide](https://docs.ansible.com/ansible/devel/user_guide/index.html)
- [Ansible Developer guide](https://docs.ansible.com/ansible/devel/dev_guide/index.html)
- [Ansible Community code of conduct](https://docs.ansible.com/ansible/devel/community/code_of_conduct.html)
- [News for Maintainers](https://github.com/ansible-collections/news-for-maintainers)

## Licensing

Copyright 2023 Ekumen, Inc.

Apache License 2.0

See [LICENSE](../LICENSE) to see full text.
43 changes: 43 additions & 0 deletions .ansible/galaxy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright 2023 Ekumen, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
namespace: ekumenlabs

name: lambkin

version: 0.1.0

readme: README.md

authors:
- Michel Hidalgo <[email protected]>

description: Ansible collection for lambkin

license:
- Apache-2.0

tags:
- lambkin
- benchmark

dependencies: {}

repository: https://github.com/ekumenlabs/lambkin
documentation: https://github.com/ekumenlabs/lambkin
homepage: https://github.com/ekumenlabs/lambkin
issues: https://github.com/ekumenlabs/lambkin/issues

build_ignore: []
2 changes: 2 additions & 0 deletions .ansible/meta/runtime.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
requires_ansible: '>= 2.14.0'
24 changes: 24 additions & 0 deletions .ansible/playbooks/local_runner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2023 Ekumen, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
- name: Setup a lambkin runner locally
hosts: localhost
connection: local
become: yes
become_method: sudo
become_flags: -i

roles:
- ekumenlabs.lambkin.runner
16 changes: 16 additions & 0 deletions .ansible/roles/common/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2023 Ekumen, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
repository_uri: "https://github.com/ekumenlabs/lambkin.git"
17 changes: 17 additions & 0 deletions .ansible/roles/common/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2023 Ekumen, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
- name: Bring LAMBKIN repository
ansible.builtin.import_tasks: repo.yml
31 changes: 31 additions & 0 deletions .ansible/roles/common/tasks/repo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright 2023 Ekumen, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
- name: Use local LAMBKIN repository
ansible.builtin.set_fact:
repository_path: "{{ repository_uri | urlsplit('path') }}"
when: repository_uri is ansible.builtin.uri(['file'])

- name: Use remote LAMBKIN repository
block:
- name: Setup repository location
ansible.builtin.set_fact:
repository_path: /tmp/repository
- name: Clone remote repository
ansible.builtin.git:
repo: "{{ repository_uri }}"
dest: "{{ repository_path }}"
depth: 1
when: repository_uri is not ansible.builtin.uri(['file'])
22 changes: 22 additions & 0 deletions .ansible/roles/runner/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2023 Ekumen, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
include_components:
- lambkin
- latex
- ros-noetic
- timemory

exclude_components: []
18 changes: 18 additions & 0 deletions .ansible/roles/runner/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2023 Ekumen, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
- name: Clear Spack caches
ansible.builtin.shell:
cmd: spack gc -y
17 changes: 17 additions & 0 deletions .ansible/roles/runner/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2023 Ekumen, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
dependencies:
- role: common
20 changes: 20 additions & 0 deletions .ansible/roles/runner/tasks/lambkin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2023 Ekumen, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
- name: Install lambkin package in full
ansible.builtin.pip:
name: "{{ repository_path }}/src/core/lambkin[full]"
state: latest
executable: pip3
23 changes: 23 additions & 0 deletions .ansible/roles/runner/tasks/latex.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2023 Ekumen, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
- name: Install TeXLive
ansible.builtin.package:
name:
- latexmk
- tex-gyre
- texlive-latex-extra
- texlive-latex-recommended
- texlive-fonts-recommended
18 changes: 18 additions & 0 deletions .ansible/roles/runner/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2023 Ekumen, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
- name: Install runner components
ansible.builtin.include_tasks: "{{item}}.yml"
loop: "{{ include_components | difference(exclude_components) }}"
52 changes: 52 additions & 0 deletions .ansible/roles/runner/tasks/ros-noetic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Copyright 2023 Ekumen, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
- name: Add packages.ros.org apt repository
ansible.builtin.apt_repository:
repo: "deb http://packages.ros.org/ros/ubuntu {{ ansible_distribution_release }} main"
filename: ros1-latest.list
state: present

- name: Add packages.ros.org apt keys
ansible.builtin.apt_key:
url: https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc
state: present

- name: Install ROS Noetic desktop
ansible.builtin.apt:
name:
- ros-noetic-desktop
- ros-noetic-map-server
state: present
update_cache: yes

- name: Setup ROS Noetic shell support
ansible.builtin.copy:
content: |
{{ "#" }} Auto-generated with Ansible {{ ansible_version.full }}
{{ "#" }} to {{ ansible_play_name | lower }}
. /opt/ros/noetic/setup.sh
dest: /etc/profile.d/ros.sh

## See https://github.com/ros/ros_comm/issues/2310
- name: Find roslaunch.nodeprocess module file
ansible.builtin.shell:
cmd: python3 -c 'import roslaunch.nodeprocess as m; print(m.__file__)'
register: module_lookup
- name: Patch roslaunch for stderr logging
ansible.builtin.replace:
path: "{{ module_lookup.stdout }}"
regexp: "if is_child_mode\\(\\):"
replace: "if True:"
Loading