This is an automated email from the ASF dual-hosted git repository. abhay pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/ranger.git
The following commit(s) were added to refs/heads/master by this push: new 3b32ec7 RANGER-3548: Update performance engine test scripts 3b32ec7 is described below commit 3b32ec719e89748f7478e64d5df448d22bfbf5b5 Author: Abhay Kulkarni <ab...@apache.org> AuthorDate: Mon Dec 13 12:58:22 2021 -0800 RANGER-3548: Update performance engine test scripts --- distro/src/main/assembly/ranger-tools.xml | 6 +++++ ranger-tools/scripts/create_tags_file.sh | 43 +++++++++++++++++++++++++++++++ ranger-tools/scripts/gen_service_tags.sh | 38 ++++++++++----------------- 3 files changed, 63 insertions(+), 24 deletions(-) diff --git a/distro/src/main/assembly/ranger-tools.xml b/distro/src/main/assembly/ranger-tools.xml index 1eb9104..b8713d8 100644 --- a/distro/src/main/assembly/ranger-tools.xml +++ b/distro/src/main/assembly/ranger-tools.xml @@ -158,5 +158,11 @@ <destName>gen_service_policies.sh</destName> <fileMode>755</fileMode> </file> + <file> + <source>${project.parent.basedir}/ranger-tools/scripts/create_tags_file.sh</source> + <outputDirectory></outputDirectory> + <destName>create_tags_file.sh</destName> + <fileMode>755</fileMode> + </file> </files> </assembly> diff --git a/ranger-tools/scripts/create_tags_file.sh b/ranger-tools/scripts/create_tags_file.sh new file mode 100755 index 0000000..ad4410d --- /dev/null +++ b/ranger-tools/scripts/create_tags_file.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. + +echo_stderr () +{ + echo "$@" >&2 +} + + +if [ $# -ne 5 ] +then + echo_stderr "usage: $0 <service_name> <num_of_tags> <initial_id> <output_file> <seconds_to_sleep>" + exit 1 +fi + +service_name=$1 +num_of_tags=$2 +initial_id=$3 +output_file=$4 +seconds_to_sleep=$5 + +echo_stderr "$0 $service_name $num_of_tags $initial_id $output_file $seconds_to_sleep" + +while true +do + ./gen_service_tags.sh ${service_name} ${num_of_tags} ${initial_id} > /tmp/$$-${output_file} + mv /tmp/$$-${output_file} ${output_file} + ((initial_id+=${num_of_tags})) + sleep ${seconds_to_sleep} +done diff --git a/ranger-tools/scripts/gen_service_tags.sh b/ranger-tools/scripts/gen_service_tags.sh index 9a81a0a..c36e4cd 100755 --- a/ranger-tools/scripts/gen_service_tags.sh +++ b/ranger-tools/scripts/gen_service_tags.sh @@ -19,28 +19,17 @@ echo_stderr () echo "$@" >&2 } -if [ $# -ne 2 ] +if [ $# -ne 3 ] then - echo_stderr "usage: $0 <service_name> <num_of_service_resources>" + echo_stderr "usage: $0 <service_name> <num_of_service_resources> <initial_id>" + exit 1 fi -service_name=cm_hive -num_of_service_resources=1 +service_name=$1 +num_of_service_resources=$2 +initial_id=$3 -if [ $# -ge 1 ] -then - service_name=$1 - echo_stderr "service_name=${service_name}, num_of_service_resources=${num_of_service_resources}" - if [ $# -ge 2 ] - then - num_of_service_resources=$2 - else - echo_stderr "service_name=${service_name}, Assuming num_of_service_resources=${num_of_service_resources}" - fi -else - echo_stderr "Assuming service_name=${service_name}, num_of_service_resources=${num_of_service_resources}" - -fi +echo_stderr "Assuming service_name=${service_name}, num_of_service_resources=${num_of_service_resources} initial_id=${initial_id}" echo "{ \"op\": \"add_or_update\", @@ -65,8 +54,8 @@ echo "{ } }, \"tags\": {" -for ((i = 1; i <= $num_of_service_resources; i++)); do - if [ $i -ne 1 ] +for ((i = ${initial_id}; i < ${initial_id} + $num_of_service_resources; i++)); do + if [ $i -ne ${initial_id} ] then echo " ," fi @@ -82,8 +71,8 @@ for ((i = 1; i <= $num_of_service_resources; i++)); do done echo " }," echo " \"serviceResources\": [" -for ((i = 1; i <= $num_of_service_resources; i++)); do - if [ $i -ne 1 ] +for ((i = ${initial_id}; i < ${initial_id} + $num_of_service_resources; i++)); do + if [ $i -ne ${initial_id} ] then echo " ," fi @@ -91,14 +80,15 @@ for ((i = 1; i <= $num_of_service_resources; i++)); do \"database\": { \"values\": [ \"finance_${i}\" ], \"isExcludes\": false, \"isRecursive\": false }, \"table\": { \"values\": [ \"tax_2020_${i}\" ], \"isExcludes\": false, \"isRecursive\": false } }, + \"serviceName\": \"${service_name}\", \"id\": ${i}, \"isEnabled\": true }" done echo " ]," echo " \"resourceToTagIds\": {" -for ((i = 1; i <= $num_of_service_resources; i++)); do - if [ $i -ne 1 ] +for ((i = ${initial_id}; i < ${initial_id} + $num_of_service_resources; i++)); do + if [ $i -ne ${initial_id} ] then echo " ," fi