Hi, start() function in zeppelin-daemon.sh starts java process for Zeppelin server. It could just simply check if launching this java process succeed or not. But some case, for example, even if java process is successfully launched, something still can be wrong and Zeppelin server is not serving anything (process is still running), We wanted CI server detect this case and for doing that, wait_zeppelin_is_up_for_ci() waits zeppelin server initializing itself and opening port and ready to serve.
Thanks, moon On Fri, Mar 6, 2015 at 3:37 PM, Taotao.Li <[email protected]> wrote: > > thanks a lot, I'm reading the source code of zeppelin, hope to contribute > something to this awesome project. > > here is the source code: > > function wait_zeppelin_is_up_for_ci() { > if [[ "${CI}" == "true" ]]; then > local count=0; > while [[ "${count}" -lt 30 ]]; do > curl -v localhost:8080 2>&1 | grep '200 OK' > if [[ $? -ne 0 ]]; then > sleep 1 > continue > else > break > fi > let "count+=1" > done > fi > } > > here is the time to execute this function: > > function start() { > local pid > > if [[ -f "${ZEPPELIN_PID}" ]]; then > pid=$(cat ${ZEPPELIN_PID}) > if kill -0 ${pid} >/dev/null 2>&1; then > echo "${ZEPPELIN_NAME} is already running" > return 0; > fi > fi > > initialize_default_directories > > nohup nice -n $ZEPPELIN_NICENESS $ZEPPELIN_RUNNER $JAVA_OPTS -cp > $CLASSPATH $ZEPPELIN_MAIN >> "${ZEPPELIN_OUTFILE}" 2>&1 < /dev/null & > pid=$! > if [[ -z "${pid}" ]]; then > action_msg "${ZEPPELIN_NAME} start" "${SET_ERROR}" > return 1; > else > action_msg "${ZEPPELIN_NAME} start" "${SET_OK}" > echo ${pid} > ${ZEPPELIN_PID} > fi > > wait_zeppelin_is_up_for_ci > sleep 2 > check_if_process_is_alive > } > > > thanks a lot >
