This is an automated email from the ASF dual-hosted git repository.

heybales pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode-benchmarks.git


The following commit(s) were added to refs/heads/develop by this push:
     new d31ae92  GEODE-6479: add username to aws keypair prefix (#62)
d31ae92 is described below

commit d31ae92661d6a1e666a77809ca0593290b1a5f08
Author: Helena Bales <[email protected]>
AuthorDate: Fri Mar 8 10:35:44 2019 -0800

    GEODE-6479: add username to aws keypair prefix (#62)
    
    * GEODE-6479: add username to aws keypair prefix
    
    Get the current username from system properties and add it to the aws
    prefix to make the instance owners more immediately identifiable. This
    should help reduce the number of instances that are left running with no
    clear owner.
    
    If it is run in CI, the username does not get added.
    
    Signed-off-by: Sean Goller <[email protected]>
---
 infrastructure/build.gradle                        |  4 ++
 infrastructure/scripts/aws/destroy_cluster.sh      | 46 ++++++++++++++++-
 infrastructure/scripts/aws/launch_cluster.sh       | 59 ++++++++++++++++++++--
 .../geode/infrastructure/BenchmarkMetadata.java    |  6 ++-
 4 files changed, 109 insertions(+), 6 deletions(-)

diff --git a/infrastructure/build.gradle b/infrastructure/build.gradle
index 3901df3..990300d 100644
--- a/infrastructure/build.gradle
+++ b/infrastructure/build.gradle
@@ -46,10 +46,14 @@ task(launchCluster, dependsOn: 'classes', type: JavaExec) {
     main = 'org.apache.geode.infrastructure.aws.LaunchCluster'
     workingDir = rootDir
     classpath = sourceSets.main.runtimeClasspath
+
+    systemProperty 'TEST_CI', project.findProperty('ci')
 }
 
 task(destroyCluster, dependsOn: 'classes', type: JavaExec) {
     main = 'org.apache.geode.infrastructure.aws.DestroyCluster'
     workingDir = rootDir
     classpath = sourceSets.main.runtimeClasspath
+
+    systemProperty 'TEST_CI', project.findProperty('ci')
 }
diff --git a/infrastructure/scripts/aws/destroy_cluster.sh 
b/infrastructure/scripts/aws/destroy_cluster.sh
index 93c2417..12006d6 100755
--- a/infrastructure/scripts/aws/destroy_cluster.sh
+++ b/infrastructure/scripts/aws/destroy_cluster.sh
@@ -17,12 +17,54 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-TAG=${1}
+TAG=
+CI=
+
+while :; do
+  case $1 in
+    -t|--tag )
+      if [ "$2" ]; then
+        TAG=$2
+        shift
+      else
+        echo 'ERROR: "--tag" requires a non-empty argument.'
+        exit 1
+      fi
+      ;;
+    --ci )
+      CI=1
+      ;;
+    -h|--help|-\? )
+      echo "Usage: $(basename "$0") -t tag -c 4 [options ...] [-- arguments 
...]"
+      echo "Options:"
+      echo "-t|--tag : Cluster tag"
+      echo "--ci : Set if starting instances for Continuous Integration"
+      echo "-- : All subsequent arguments are passed to the benchmark task as 
arguments."
+      echo "-h|--help : This help message"
+      exit 1
+      ;;
+    -- )
+      shift
+      break
+      ;;
+    -?* )
+      printf 'Invalid option: %s\n' "$1" >&2
+      break
+      ;;
+    * )
+      break
+  esac
+  shift
+done
 
 if [[ -z "${AWS_ACCESS_KEY_ID}" ]]; then
   export AWS_PROFILE="geode-benchmarks"
 fi
 
+if [ -z "${CI}" ]; then
+  CI=0
+fi
+
 pushd ../../../
-./gradlew destroyCluster --args "${TAG}"
+./gradlew destroyCluster -Pci=${CI} --args "${TAG}"
 popd
diff --git a/infrastructure/scripts/aws/launch_cluster.sh 
b/infrastructure/scripts/aws/launch_cluster.sh
index 611c92d..57fce7f 100755
--- a/infrastructure/scripts/aws/launch_cluster.sh
+++ b/infrastructure/scripts/aws/launch_cluster.sh
@@ -19,12 +19,65 @@
 
 set -e
 
-TAG=${1}
-COUNT=${2}
+TAG=
+COUNT=
+CI=
+
+while :; do
+  case $1 in
+    -t|--tag )
+      if [ "$2" ]; then
+        TAG=$2
+        shift
+      else
+        echo 'ERROR: "--tag" requires a non-empty argument.'
+        exit 1
+      fi
+      ;;
+    -c|--count )
+      if [ "$2" ]; then
+        COUNT=$2
+        shift
+      else
+        echo 'ERROR: "--count" requires a non-empty argument.'
+        exit 1
+      fi
+      ;;
+    --ci )
+      CI=1
+      ;;
+    -h|--help|-\? )
+      echo "Usage: $(basename "$0") -t tag -c 4 [options ...] [-- arguments 
...]"
+      echo "Options:"
+      echo "-t|--tag : Cluster tag"
+      echo "-c|--count : The number of instances to start"
+      echo "--ci : Set if starting instances for Continuous Integration"
+      echo "-- : All subsequent arguments are passed to the benchmark task as 
arguments."
+      echo "-h|--help : This help message"
+      exit 1
+      ;;
+    -- )
+      shift
+      break
+      ;;
+    -?* )
+      printf 'Invalid option: %s\n' "$1" >&2
+      break
+      ;;
+    * )
+      break
+  esac
+  shift
+done
+
 if [[ -z "${AWS_ACCESS_KEY_ID}" ]]; then
   export AWS_PROFILE="geode-benchmarks"
 fi
 
+if [ -z "${CI}" ]; then
+  CI=0
+fi
+
 pushd ../../../
-./gradlew launchCluster --args "${TAG} ${COUNT}"
+./gradlew launchCluster -Pci=${CI} --args "${TAG} ${COUNT}"
 popd
diff --git 
a/infrastructure/src/main/java/org/apache/geode/infrastructure/BenchmarkMetadata.java
 
b/infrastructure/src/main/java/org/apache/geode/infrastructure/BenchmarkMetadata.java
index 550ef15..22c5d48 100644
--- 
a/infrastructure/src/main/java/org/apache/geode/infrastructure/BenchmarkMetadata.java
+++ 
b/infrastructure/src/main/java/org/apache/geode/infrastructure/BenchmarkMetadata.java
@@ -23,7 +23,11 @@ public class BenchmarkMetadata {
   public static String PREFIX = "geode-benchmarks";
 
   public static String benchmarkPrefix(String tag) {
-    return PREFIX + "-" + tag;
+    if (System.getProperty("TEST_CI").equals("1")) {
+      return PREFIX + "-" + tag;
+    } else {
+      return PREFIX + "-" + System.getProperty("user.name") + "-" + tag;
+    }
   }
 
   public static String benchmarkString(String tag, String suffix) {

Reply via email to