You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by br...@apache.org on 2014/12/12 21:01:04 UTC

svn commit: r1645054 - in /hive/trunk/testutils/ptest2/src: main/java/org/apache/hive/ptest/execution/context/ test/java/org/apache/hive/ptest/execution/

Author: brock
Date: Fri Dec 12 20:01:04 2014
New Revision: 1645054

URL: http://svn.apache.org/r1645054
Log:
HIVE-6623 - Add "owner" tag to ptest2 created instances (Brock reviewed by Szehon)

Modified:
    hive/trunk/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/context/CloudComputeService.java
    hive/trunk/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/context/CloudExecutionContextProvider.java
    hive/trunk/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testAlternativeTestJVM.approved.txt
    hive/trunk/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testBatch.approved.txt

Modified: hive/trunk/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/context/CloudComputeService.java
URL: http://svn.apache.org/viewvc/hive/trunk/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/context/CloudComputeService.java?rev=1645054&r1=1645053&r2=1645054&view=diff
==============================================================================
--- hive/trunk/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/context/CloudComputeService.java (original)
+++ hive/trunk/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/context/CloudComputeService.java Fri Dec 12 20:01:04 2014
@@ -20,6 +20,7 @@ package org.apache.hive.ptest.execution.
 
 import java.util.Collections;
 import java.util.Properties;
+import java.util.Map;
 import java.util.Set;
 
 import org.jclouds.Constants;
@@ -53,12 +54,13 @@ public class CloudComputeService {
   private final String mImageId;
   private final String mkeyPair;
   private final String mSecurityGroup;
+  private final Map<String, String> mUserMetadata;
   /**
    * JClouds requests on-demand instances when null
    */
   private final Float mMaxBid;
   public CloudComputeService(String apiKey, String accessKey, String instanceType, String groupName,
-      String imageId, String keyPair, String securityGroup, Float maxBid) {
+      String imageId, String keyPair, String securityGroup, Float maxBid, Map<String,String> userMetadata) {
     mInstanceType = instanceType;
     mGroupName = groupName;
     mImageId = imageId;
@@ -66,6 +68,7 @@ public class CloudComputeService {
     mSecurityGroup = securityGroup;
     mMaxBid = maxBid;
     mGroupTag = "group=" + mGroupName;
+    mUserMetadata = userMetadata;
     Properties overrides = new Properties();
     overrides.put(ComputeServiceProperties.POLL_INITIAL_PERIOD, String.valueOf(60L * 1000L));
     overrides.put(ComputeServiceProperties.POLL_MAX_PERIOD, String.valueOf(600L * 1000L));
@@ -84,7 +87,8 @@ public class CloudComputeService {
         .hardwareId(mInstanceType).imageId(mImageId).build();
     template.getOptions().as(AWSEC2TemplateOptions.class).keyPair(mkeyPair)
     .securityGroupIds(mSecurityGroup).blockOnPort(22, 60)
-    .spotPrice(mMaxBid).tags(Collections.singletonList(mGroupTag));
+    .spotPrice(mMaxBid).tags(Collections.singletonList(mGroupTag))
+    .userMetadata(mUserMetadata);
     result.addAll(mComputeService.createNodesInGroup(mGroupName, count, template));
     return result;
   }

Modified: hive/trunk/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/context/CloudExecutionContextProvider.java
URL: http://svn.apache.org/viewvc/hive/trunk/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/context/CloudExecutionContextProvider.java?rev=1645054&r1=1645053&r2=1645054&view=diff
==============================================================================
--- hive/trunk/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/context/CloudExecutionContextProvider.java (original)
+++ hive/trunk/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/context/CloudExecutionContextProvider.java Fri Dec 12 20:01:04 2014
@@ -69,6 +69,7 @@ public class CloudExecutionContextProvid
   public static final String USERNAME = "user";
   public static final String INSTANCE_TYPE = "instanceType";
   public static final String NUM_THREADS = "numThreads";
+  public static final String USER_METADATA = "userMetadata";
 
   private final RandomAccessFile mHostLog;
   private final String mPrivateKey;
@@ -449,7 +450,7 @@ public class CloudExecutionContextProvid
     Integer numThreads = context.getInteger(NUM_THREADS, 3);
     String instanceType = context.getString(INSTANCE_TYPE, "c1.xlarge");
     CloudComputeService cloudComputeService = new CloudComputeService(apiKey, accessKey,
-        instanceType, groupName, imageId, keyPair, securityGroup, maxBid);
+        instanceType, groupName, imageId, keyPair, securityGroup, maxBid, context.getSubProperties(USER_METADATA + "."));
     CloudExecutionContextProvider service = new CloudExecutionContextProvider(
         dataDir, numHosts, cloudComputeService, new SSHCommandExecutor(LOG), workingDirectory,
         privateKey, user, localDirs, numThreads, 60, maxHostsPerCreateRequest);

Modified: hive/trunk/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testAlternativeTestJVM.approved.txt
URL: http://svn.apache.org/viewvc/hive/trunk/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testAlternativeTestJVM.approved.txt?rev=1645054&r1=1645053&r2=1645054&view=diff
==============================================================================
--- hive/trunk/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testAlternativeTestJVM.approved.txt (original)
+++ hive/trunk/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testAlternativeTestJVM.approved.txt Fri Dec 12 20:01:04 2014
@@ -85,7 +85,7 @@ fi
 echo $pid >> batch.pid
 wait $pid
 ret=$?
-find ./ -type f -name hive.log | \
+find ./ -type f -name hive.log -o -name spark.log | \
   xargs -I {} sh -c 'f=$(basename {}); test -f /some/log/dir/$f && f=$f-$(uuidgen); mv {} /some/log/dir/$f'
 find ./ -type f -name 'TEST-*.xml' | \
   xargs -I {} sh -c 'f=TEST-batch-1-$(basename {}); test -f /some/log/dir/$f && f=$f-$(uuidgen); mv {} /some/log/dir/$f'

Modified: hive/trunk/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testBatch.approved.txt
URL: http://svn.apache.org/viewvc/hive/trunk/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testBatch.approved.txt?rev=1645054&r1=1645053&r2=1645054&view=diff
==============================================================================
--- hive/trunk/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testBatch.approved.txt (original)
+++ hive/trunk/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testBatch.approved.txt Fri Dec 12 20:01:04 2014
@@ -85,7 +85,7 @@ fi
 echo $pid >> batch.pid
 wait $pid
 ret=$?
-find ./ -type f -name hive.log | \
+find ./ -type f -name hive.log -o -name spark.log | \
   xargs -I {} sh -c 'f=$(basename {}); test -f /some/log/dir/$f && f=$f-$(uuidgen); mv {} /some/log/dir/$f'
 find ./ -type f -name 'TEST-*.xml' | \
   xargs -I {} sh -c 'f=TEST-batch-1-$(basename {}); test -f /some/log/dir/$f && f=$f-$(uuidgen); mv {} /some/log/dir/$f'