Commit 19802c09 authored by Tobias Winchen's avatar Tobias Winchen
Browse files

Refactor+fix parallel launch

parent a40c85b3
---
- set_fact:
async_list: []
tags:
- always
- file:
path: "{{ data_dir }}"
state: directory
......@@ -41,6 +46,43 @@
poll: 0
register: async_results_tmp
- name: "{{ image_name }}:: Stop EDD docker container"
block:
- name: Get docker logs
command: docker logs "{{ container_name }}"
register: dck_lg
ignore_errors: yes
- name: Save to file
copy:
content: "{{ dck_lg.stderr_lines | join('\n') }}"
dest: "{{ data_dir }}/{{ container_name }}_{{ ansible_date_time.iso8601_micro}}.log"
mode: g+rw
owner: "{{ edd_user }}"
group: "{{ edd_group }}"
ignore_errors: yes
- docker_container:
name: "{{ container_name }}"
state: absent
async: 300
poll: 0
register: async_results_tmp
- set_fact:
edd_container: '{{ edd_container | dict2items | rejectattr( "key", "equalto", container_name )|list|items2dict }}'
cacheable: true
tags:
- never
- stop
- set_fact:
async_list: "{{ async_list + [ async_results_tmp.ansible_job_id ] }}"
tags:
- always
- name: Using Dashboard
block:
......@@ -79,31 +121,56 @@
- set_fact:
edd_container: '{{ edd_container | dict2items | rejectattr( "key", "equalto", container_name )|list|items2dict }}'
cacheable: true
- set_fact:
async_list: "{{ async_list + [ async_results_tmp.ansible_job_id ] }}"
tags:
- always
when: install_dashboard
- name: "{{ image_name }}:: Launch influx sidecar"
include_role:
name: influx_sidecar
vars:
pipeline_id: "{{ container_name }}"
katcp_host: "{{ inventory_hostname }}"
katcp_port: "{{ bind_port }}"
exclude_sensors: "{% if influx_exclude_sensors is defined and influx_exclude_sensors%} {{ influx_exclude_sensors }} {% endif %}"
tags:
- always
block:
- include_role:
name: influx_sidecar
vars:
pipeline_id: "{{ container_name }}"
katcp_host: "{{ inventory_hostname }}"
katcp_port: "{{ bind_port }}"
exclude_sensors: "{% if influx_exclude_sensors is defined and influx_exclude_sensors%} {{ influx_exclude_sensors }} {% endif %}"
tags:
- always
- set_fact:
async_list: "{{ async_list + [ async_results_tmp.ansible_job_id ] }}"
tags:
- always
when: launch_influx_sidecar
- name: "{{ image_name }}:: Launch redis sidecar"
include_role:
name: redis_sidecar
vars:
pipeline_id: "{{ container_name }}"
katcp_host: "{{ inventory_hostname }}"
katcp_port: "{{ bind_port }}"
tags:
- always
block:
- include_role:
name: redis_sidecar
vars:
pipeline_id: "{{ container_name }}"
katcp_host: "{{ inventory_hostname }}"
katcp_port: "{{ bind_port }}"
tags:
- always
- set_fact:
async_list: "{{ async_list + [ async_results_tmp.ansible_job_id ] }}"
tags:
- always
when: launch_redis_sidecar
- name: "{{ image_name }}:: Wait for async job results"
async_status:
jid: "{{ item }}"
loop: "{{ async_list }}"
register: job_result
until: job_result.finished
retries: 100
delay: 3
tags:
- always
......@@ -17,61 +17,8 @@
- debug:
msg: " {{ container_name }} katcp free port found {{ bind_port }} -- image+version: {{ image_name }}:{{ version_tag }} "
- set_fact:
async_list: []
tags:
- always
- name: "{{ image_name }}:: Launch EDD docker container"
import_tasks: launch_tasks.yml
- set_fact:
async_list: "{{ async_list + [ async_results_tmp.ansible_job_id ] }}"
- name: "{{ image_name }}:: Stop EDD docker container"
block:
- name: Get docker logs
command: docker logs "{{ container_name }}"
register: dck_lg
ignore_errors: yes
- name: Save to file
copy:
content: "{{ dck_lg.stderr_lines | join('\n') }}"
dest: "{{ data_dir }}/{{ container_name }}_{{ ansible_date_time.iso8601_micro}}.log"
mode: g+rw
owner: "{{ edd_user }}"
group: "{{ edd_group }}"
ignore_errors: yes
- docker_container:
name: "{{ container_name }}"
state: absent
async: 300
poll: 0
register: async_results_tmp
- set_fact:
edd_container: '{{ edd_container | dict2items | rejectattr( "key", "equalto", container_name )|list|items2dict }}'
cacheable: true
tags:
- never
- stop
- set_fact:
async_list: "{{ async_list + [ async_results_tmp.ansible_job_id ] }}"
- name: "{{ image_name }}:: Wait for async job results"
async_status:
jid: "{{ item }}"
loop: "{{ async_list }}"
register: job_result
until: job_result.finished
retries: 100
delay: 3
tags:
- always
---
- set_fact:
async_list: []
tags:
- always
- name: Build master controller
tags:
- never
......@@ -55,24 +49,8 @@
bind_port: "{{ master_controller_port }}"
launch_influx_sidecar: true
launch_redis_sidecar: true
install_dashboard: false
register_as_pipeline: false
- set_fact:
master_controller_ip: "{{ ansible_host }}"
- set_fact:
async_list: "{{ async_list + [ async_results_tmp.ansible_job_id ] }}"
- name: "{{ image_name }}:: Wait for async job results"
async_status:
jid: "{{ item }}"
loop: "{{ async_list }}"
register: job_result
until: job_result.finished
retries: 100
delay: 3
tags:
- always
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment