You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@zeppelin.apache.org by "Taotao.Li" <ta...@datayes.com> on 2015/03/06 07:37:04 UTC

hi, I want to know what's the usage of wait_zeppelin_is_up_for_ci function in zeppelin-daemon.sh?thanks

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

Re: hi, I want to know what's the usage of wait_zeppelin_is_up_for_ci function in zeppelin-daemon.sh?thanks

Posted by moon soo Lee <mo...@apache.org>.
Zeppelin uses travis as it's CI server.
CI environment variable is set by travis. Check
http://docs.travis-ci.com/user/ci-environment/#Environment-variables

Thanks,
moon

On Sun, Mar 8, 2015 at 12:34 AM, Taotao.Li <ta...@datayes.com> wrote:

> Hi, but to execute wait_zeppelin_is_up_for_ci, should we first define a
> variable CI as "true"? I want to know where the variable CI was defined?
> thanks
>
> ------------------------------
> *发件人: *"moon soo Lee" <mo...@apache.org>
> *收件人: *users@zeppelin.incubator.apache.org
> *发送时间: *星期六, 2015年 3 月 07日 上午 8:53:52
> *主题: *Re: hi, I want to know what's the usage of
> wait_zeppelin_is_up_for_ci function in zeppelin-daemon.sh?thanks
>
>
> 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 <ta...@datayes.com> 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
>>
>
>
>
>

Re: hi, I want to know what's the usage of wait_zeppelin_is_up_for_ci function in zeppelin-daemon.sh?thanks

Posted by "Taotao.Li" <ta...@datayes.com>.
Hi, but to execute wait_zeppelin_is_up_for_ci, should we first define a variable CI as "true"? I want to know where the variable CI was defined? thanks 

----- 原始邮件 -----

发件人: "moon soo Lee" <mo...@apache.org> 
收件人: users@zeppelin.incubator.apache.org 
发送时间: 星期六, 2015年 3 月 07日 上午 8:53:52 
主题: Re: hi, I want to know what's the usage of wait_zeppelin_is_up_for_ci function in zeppelin-daemon.sh?thanks 

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 < taotao.li@datayes.com > 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 







Re: hi, I want to know what's the usage of wait_zeppelin_is_up_for_ci function in zeppelin-daemon.sh?thanks

Posted by moon soo Lee <mo...@apache.org>.
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 <ta...@datayes.com> 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
>