mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
ZEPPELIN-207: travis-ci build log is too long to be displayed
This commit is contained in:
parent
9186b2186d
commit
e5b00673ab
5 changed files with 125 additions and 1 deletions
|
|
@ -22,7 +22,7 @@ before_install:
|
|||
- "sh -e /etc/init.d/xvfb start"
|
||||
|
||||
install:
|
||||
- mvn package -DskipTests -Phadoop-2.3 -Ppyspark -B
|
||||
- /bin/bash ./dev/travis/travis-install.sh `pwd`
|
||||
|
||||
before_script:
|
||||
-
|
||||
|
|
|
|||
15
1.sh
Executable file
15
1.sh
Executable file
|
|
@ -0,0 +1,15 @@
|
|||
#/bin/bash
|
||||
nohup mvn package -DskipTests -Phadoop-2.3 -Ppyspark -B 2>&1 > install.log &
|
||||
count=0
|
||||
nextPrint=$(date +%s)
|
||||
while read line; do
|
||||
count=$((count+=1))
|
||||
now=$(date +%s)
|
||||
if [[ $now -gt $nextPrint ]];then
|
||||
echo "Text read from file: $count"
|
||||
sleep 2
|
||||
now=$(date +%s)
|
||||
nextPrint=$((now+10))
|
||||
fi
|
||||
|
||||
done < "install.log"
|
||||
54
dev/travis/save-logs.py
Executable file
54
dev/travis/save-logs.py
Executable file
|
|
@ -0,0 +1,54 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed 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.
|
||||
|
||||
import sys
|
||||
import subprocess
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
def main(file, cmd):
|
||||
print cmd, "writing to", file
|
||||
out = open(file, "w")
|
||||
count = 0
|
||||
process = subprocess.Popen(cmd,
|
||||
stderr=subprocess.STDOUT,
|
||||
stdout=subprocess.PIPE)
|
||||
|
||||
start = datetime.now()
|
||||
nextPrint = datetime.now() + timedelta(seconds=1)
|
||||
# wait for the process to terminate
|
||||
pout = process.stdout
|
||||
line = pout.readline()
|
||||
while line:
|
||||
count = count + 1
|
||||
if datetime.now() > nextPrint:
|
||||
diff = datetime.now() - start
|
||||
sys.stdout.write("\r%d seconds %d log lines"%(diff.seconds, count))
|
||||
sys.stdout.flush()
|
||||
nextPrint = datetime.now() + timedelta(seconds=10)
|
||||
out.write(line)
|
||||
line = pout.readline()
|
||||
out.close()
|
||||
errcode = process.wait()
|
||||
diff = datetime.now() - start
|
||||
sys.stdout.write("\r%d seconds %d log lines"%(diff.seconds, count))
|
||||
print
|
||||
print cmd, "done", errcode
|
||||
return errcode
|
||||
|
||||
if __name__ == "__main__":
|
||||
if sys.argv < 1:
|
||||
print "Usage: %s [file info]" % sys.argv[0]
|
||||
sys.exit(1)
|
||||
|
||||
sys.exit(main(sys.argv[1], sys.argv[2:]))
|
||||
30
dev/travis/travis-install.sh
Executable file
30
dev/travis/travis-install.sh
Executable file
|
|
@ -0,0 +1,30 @@
|
|||
#!/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.
|
||||
#
|
||||
ZEPPELIN_SRC_ROOT_DIR=$1
|
||||
TRAVIS_SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
cd ${ZEPPELIN_SRC_ROOT_DIR}
|
||||
|
||||
python ${TRAVIS_SCRIPT_DIR}/save-logs.py "install.txt" mvn package -DskipTests -Phadoop-2.3 -Ppyspark -B
|
||||
BUILD_RET_VAL=$?
|
||||
|
||||
if [[ "$BUILD_RET_VAL" != "0" ]];
|
||||
then
|
||||
cat "install.txt"
|
||||
fi
|
||||
|
||||
exit ${BUILD_RET_VAL}
|
||||
25
save-log-with-progress.sh
Executable file
25
save-log-with-progress.sh
Executable file
|
|
@ -0,0 +1,25 @@
|
|||
#/bin/bash
|
||||
function ProgressBar {
|
||||
let _progress=(${1}*100/${2}*100)/100
|
||||
let _done=(${_progress}*4)/10
|
||||
let _left=40-$_done
|
||||
_done=$(printf "%${_done}s")
|
||||
_left=$(printf "%${_left}s")
|
||||
|
||||
printf "\rProgress : [${_done// /#}${_left// /-}] ${_progress}%%"
|
||||
|
||||
}
|
||||
|
||||
# Variables
|
||||
_start=1
|
||||
|
||||
# This accounts as the "totalState" variable for the ProgressBar function
|
||||
_end=100
|
||||
|
||||
# Proof of concept
|
||||
for number in $(seq ${_start} ${_end})
|
||||
do
|
||||
sleep 0.1
|
||||
ProgressBar ${number} ${_end}
|
||||
done
|
||||
printf '\nFinished!\n'
|
||||
Loading…
Reference in a new issue