You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by ra...@apache.org on 2021/04/21 18:17:16 UTC
[trafficcontrol] branch master updated:
Dataset.loader.perf.improvements (#5770)
This is an automated email from the ASF dual-hosted git repository.
rawlin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
The following commit(s) were added to refs/heads/master by this push:
new f3d4220 Dataset.loader.perf.improvements (#5770)
f3d4220 is described below
commit f3d4220f61edcfbff7bb93efca692ae51f4bf0e9
Author: Jonathan G <jh...@users.noreply.github.com>
AuthorDate: Wed Apr 21 12:16:58 2021 -0600
Dataset.loader.perf.improvements (#5770)
* Only Create DS profiles if necessary
* Fix bug that lead to DS being created multiple times
---
.../roles/dataset_loader/tasks/create_ds_profiles_params.yml | 8 ++++----
.../ansible/roles/dataset_loader/tasks/dataset_loader.yml | 5 -----
infrastructure/ansible/roles/dataset_loader/tasks/ds_loader.yml | 5 +++++
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/infrastructure/ansible/roles/dataset_loader/tasks/create_ds_profiles_params.yml b/infrastructure/ansible/roles/dataset_loader/tasks/create_ds_profiles_params.yml
index 81dbb26..b45e7ff 100644
--- a/infrastructure/ansible/roles/dataset_loader/tasks/create_ds_profiles_params.yml
+++ b/infrastructure/ansible/roles/dataset_loader/tasks/create_ds_profiles_params.yml
@@ -16,8 +16,8 @@
url: "{{ dl_to_url }}/api/{{ dl_to_api_version }}/profiles"
method: POST
body: "{{ lookup('template', 'profile.j2') }}"
- with_items: "{{ dl_ds_merged_profile_cdntemplates }}"
- when: ( item.type == 'DS_PROFILE' )
+ with_items: "{{ dl_ds_merged_profile_cdntemplates | selectattr('type','equalto','DS_PROFILE') }}"
+ when: ( (fixed_profile_name != '' and fixed_profile_name == item.name) or (ds_suffix != '' and item.name.endswith(ds_suffix)) )
vars:
name: "{{ item.name }}"
description: "{{ item.description }}"
@@ -35,8 +35,8 @@
url: "{{ dl_to_url }}/api/{{ dl_to_api_version }}/profiles/name/{{ item.name }}/parameters"
method: POST
body: "{{ lookup('template', 'parameter.j2') }}"
- when: ( item.type == 'DS_PROFILE' and target_xmlId is defined )
- with_items: "{{ dl_ds_merged_profile_cdntemplates }}"
+ with_items: "{{ dl_ds_merged_profile_cdntemplates | selectattr('type','equalto','DS_PROFILE') }}"
+ when: ( (fixed_profile_name != '' and fixed_profile_name == item.name) or (ds_suffix != '' and item.name.endswith(ds_suffix)) )
vars:
cdn_query: "response[?name == '{{ item.cdn | default('ALL') }}'].id | [0]"
error_query: "alerts[?level=='error'].text[?!contains(@,'already exists')]"
diff --git a/infrastructure/ansible/roles/dataset_loader/tasks/dataset_loader.yml b/infrastructure/ansible/roles/dataset_loader/tasks/dataset_loader.yml
index 8189626..918539b 100644
--- a/infrastructure/ansible/roles/dataset_loader/tasks/dataset_loader.yml
+++ b/infrastructure/ansible/roles/dataset_loader/tasks/dataset_loader.yml
@@ -802,11 +802,6 @@
method: GET
register: get_all_servers
-- name: Collect All CDN delegations assigned to Fake Origins
- set_fact:
- cdnDelegationList: "{{ (cdnDelegationList | default([]) ) + [hostvars[item]['cdn']] }}"
- with_items: "{{ groups['fakeorigin'] }}"
-
- name: Convert the CDN Delegation list into an index
set_fact:
cdnDelegationIndex: "{{ (cdnDelegationIndex | default({}) ) | combine( { item.1: item.0 } ) }}"
diff --git a/infrastructure/ansible/roles/dataset_loader/tasks/ds_loader.yml b/infrastructure/ansible/roles/dataset_loader/tasks/ds_loader.yml
index d5f1f8a..6539a47 100644
--- a/infrastructure/ansible/roles/dataset_loader/tasks/ds_loader.yml
+++ b/infrastructure/ansible/roles/dataset_loader/tasks/ds_loader.yml
@@ -17,6 +17,11 @@
with_items: "{{ dl_ds_merged_ds_template }}"
loop_control:
loop_var: Target_ds
+ when: ( fixed_profile_name is defined or ds_suffix is defined )
+ vars:
+ fixed_profile_name: "{{ Target_ds.profileName | default(dl_ds_default_ds.profileName) | default() }}"
+ ds_suffix: "{{ Target_ds.profileNameSuffix | default(dl_ds_default_ds.profileNameSuffix) | default() }}"
+
- name: Get All Profiles
uri: