impala-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tarmstr...@apache.org
Subject [1/3] incubator-impala git commit: Improve message output from run-step.sh
Date Thu, 17 Nov 2016 21:57:32 GMT
Repository: incubator-impala
Updated Branches:
  refs/heads/master eb8120d21 -> 46f5ad48e


Improve message output from run-step.sh

run-step prints a message to tell the reader what it's doing. However,
that message wasn't flushed so that run-step could print OK or FAILED on
the same line. The result was that long-running steps wouldn't print
anything to the log until they were done, at least in Jenkins contexts.

This patch changes it so that the message is flushed, and then the
result is printed on a separate line (including the time it took to run
the step).

  $ run-step "Hello world!" helloworld.out sleep 5
  Hello world! (logging to /tmp/helloworld.out)...
      OK (Took: 0 min 5 sec)

Change-Id: Iaced729f0ef6aa93174cd90b1516d3c34fe41a22
Reviewed-on: http://gerrit.cloudera.org:8080/5116
Reviewed-by: Alex Behm <alex.behm@cloudera.com>
Tested-by: Internal 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/2648bfbd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/2648bfbd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/2648bfbd

Branch: refs/heads/master
Commit: 2648bfbd90e6ef193f03a138e5a6903dd17626f1
Parents: eb8120d
Author: Henry Robinson <henry@cloudera.com>
Authored: Wed Nov 16 16:38:48 2016 -0800
Committer: Internal Jenkins <cloudera-hudson@gerrit.cloudera.org>
Committed: Thu Nov 17 09:35:14 2016 +0000

----------------------------------------------------------------------
 testdata/bin/run-step.sh | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/2648bfbd/testdata/bin/run-step.sh
----------------------------------------------------------------------
diff --git a/testdata/bin/run-step.sh b/testdata/bin/run-step.sh
index e3e516e..45c5774 100755
--- a/testdata/bin/run-step.sh
+++ b/testdata/bin/run-step.sh
@@ -37,13 +37,16 @@ function run-step {
   fi
   local LOG=${LOG_DIR}/${LOG_FILE_NAME}
 
-  echo -n "${MSG} (logging to ${LOG})... "
+  echo "${MSG} (logging to ${LOG})... "
   echo "Log for command '$@'" > ${LOG}
+  START_TIME=$SECONDS
   if ! "$@" >> ${LOG} 2>&1 ; then
-    echo "FAILED"
-    echo "'$@' failed. Tail of log:"
+    ELAPSED_TIME=$(($SECONDS - $START_TIME))
+    echo "    FAILED (Took: $(($ELAPSED_TIME/60)) min $(($ELAPSED_TIME%60)) sec)"
+    echo "    '$@' failed. Tail of log:"
     tail -n50 ${LOG}
     return 1
   fi
-  echo OK
+  ELAPSED_TIME=$(($SECONDS - $START_TIME))
+  echo "    OK (Took: $(($ELAPSED_TIME/60)) min $(($ELAPSED_TIME%60)) sec)"
 }


Mime
View raw message