Repository: incubator-impala
Updated Branches:
  refs/heads/master 801c32dec -> 7761692fb


single_node_perf_run.py: clean up newly-added testdata

In single_node_perf_run.py, restore_workloads() can make the tree
"dirty", and when a tree is dirty, git won't let you switch branches
in a way that clobbers the dirty file contents:

    $ cd $(mktemp -d)
    $ git init .
    Initialized empty Git repository in /tmp/tmp.H0NxzTXLUj/.git/
    $ touch foo && git add foo && git commit -a -m "foo"
    [master (root-commit) 3776149] foo
     1 file changed, 0 insertions(+), 0 deletions(-)
     create mode 100644 foo
    $ git checkout -b ok_foo && echo "ok" >> foo && git commit -a -m "foo is ok"
    Switched to a new branch 'ok_foo'
    [ok_foo 9fd5bde] foo is ok
     1 file changed, 1 insertion(+)
    $ git checkout master && echo "not ok" >> foo
    Switched to branch 'master'
    $ git checkout ok_foo
    error: Your local changes to the following files would be overwritten by 
checkout:
            foo
    Please, commit your changes or stash them before you can switch branches.
    Aborting

Discovered when testing single_node_perf_run with
https://gerrit.cloudera.org/#/c/7153/; after this commit, that patch
works with single_node_perf_run.py

Change-Id: Id0220f3cd7a26d2627e40cd432c23815a6d65ea4
Reviewed-on: http://gerrit.cloudera.org:8080/7291
Reviewed-by: Jim Apple <[email protected]>
Tested-by: Impala Public Jenkins


Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/01b5973c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/01b5973c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/01b5973c

Branch: refs/heads/master
Commit: 01b5973c403ab93d1a5aa3ba1ed4c4cb95befb54
Parents: 801c32d
Author: Jim Apple <[email protected]>
Authored: Fri Jun 16 21:27:29 2017 -0700
Committer: Impala Public Jenkins <[email protected]>
Committed: Tue Jul 11 00:12:24 2017 +0000

----------------------------------------------------------------------
 bin/single_node_perf_run.py | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/01b5973c/bin/single_node_perf_run.py
----------------------------------------------------------------------
diff --git a/bin/single_node_perf_run.py b/bin/single_node_perf_run.py
index b9fe095..b67f661 100755
--- a/bin/single_node_perf_run.py
+++ b/bin/single_node_perf_run.py
@@ -58,6 +58,7 @@ from tempfile import mkdtemp
 import json
 import os
 import sh
+import shutil
 import subprocess
 import sys
 import textwrap
@@ -229,6 +230,7 @@ def perf_ab_test(options, args):
   if len(args) > 1 and args[1]:
     hash_b = get_git_hash_for_name(args[1])
     # discard any changes created by the previous restore_workloads()
+    shutil.rmtree("testdata/workloads")
     sh.git.checkout("--", "testdata/workloads")
     build(hash_b, options)
     restore_workloads(workload_dir)
@@ -298,11 +300,14 @@ def main():
     current_hash = get_git_hash_for_name("HEAD")
 
   try:
+    workloads = backup_workloads()
     perf_ab_test(options, args)
   finally:
     # discard any changes created by the previous restore_workloads()
+    shutil.rmtree("testdata/workloads")
     sh.git.checkout("--", "testdata/workloads")
     sh.git.checkout(current_hash)
+    restore_workloads(workloads)
 
 
 if __name__ == "__main__":

Reply via email to