[
https://issues.apache.org/jira/browse/FLINK-4208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15378305#comment-15378305
]
ASF GitHub Bot commented on FLINK-4208:
---------------------------------------
Github user greghogan commented on a diff in the pull request:
https://github.com/apache/flink/pull/2239#discussion_r70877433
--- Diff: flink-dist/src/main/flink-bin/bin/flink-daemon.sh ---
@@ -77,31 +77,36 @@ if [[ ${JAVA_VERSION} =~ ${IS_NUMBER} ]]; then
fi
case $STARTSTOP in
+ (start|start-foreground)
+ # Rotate log files
+ rotateLogFile $log
+ rotateLogFile $out
+
+ # Print a warning if daemons are already running on host
+ if [ -f $pid ]; then
+ active=()
+ while IFS='' read -r p || [[ -n "$p" ]]; do
+ kill -0 $p >/dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ active+=($p)
+ fi
+ done < "${pid}"
- (start)
- # Rotate log files
- rotateLogFile $log
- rotateLogFile $out
-
- # Print a warning if daemons are already running on host
- if [ -f $pid ]; then
- active=()
- while IFS='' read -r p || [[ -n "$p" ]]; do
- kill -0 $p >/dev/null 2>&1
- if [ $? -eq 0 ]; then
- active+=($p)
- fi
- done < "${pid}"
-
- count="${#active[@]}"
+ count="${#active[@]}"
- if [ ${count} -gt 0 ]; then
- echo "[INFO] $count instance(s) of $DAEMON are already running
on $HOSTNAME."
- fi
+ if [ ${count} -gt 0 ]; then
+ echo "[INFO] $count instance(s) of $DAEMON are already running
on $HOSTNAME."
fi
+ fi
+
+ if [[ $STARTSTOP == "start-foreground" ]]; then
+ echo "Starting $DAEMON as a foreground process on host $HOSTNAME."
+ $JAVA_RUN $JVM_ARGS ${FLINK_ENV_JAVA_OPTS} "${log_setting[@]}"
-classpath "`manglePathList "$FLINK_TM_CLASSPATH:$INTERNAL_HADOOP_CLASSPATHS"`"
${CLASS_TO_RUN} "${ARGS[@]}" > "$out" 2>&1 < /dev/null
+ fi
+ if [[ $STARTSTOP == "start" ]]; then
echo "Starting $DAEMON daemon on host $HOSTNAME."
- $JAVA_RUN $JVM_ARGS ${FLINK_ENV_JAVA_OPTS} "${log_setting[@]}"
-classpath "`manglePathList "$FLINK_TM_CLASSPATH:$INTERNAL_HADOOP_CLASSPATHS"`"
${CLASS_TO_RUN} "${ARGS[@]}" > "$out" 2>&1 < /dev/null &
+ nohup $JAVA_RUN $JVM_ARGS ${FLINK_ENV_JAVA_OPTS}
"${log_setting[@]}" -classpath "`manglePathList
"$FLINK_TM_CLASSPATH:$INTERNAL_HADOOP_CLASSPATHS"`" ${CLASS_TO_RUN}
"${ARGS[@]}" > "$out" 2>&1 < /dev/null &
--- End diff --
This is excellent documentation. It looks like (from a `grep daemon`
through the code) that Flink is daemonizing its threads internally. Perhaps
@StephanEwen can look at this.
> Support Running Flink processes in foreground mode
> --------------------------------------------------
>
> Key: FLINK-4208
> URL: https://issues.apache.org/jira/browse/FLINK-4208
> Project: Flink
> Issue Type: Improvement
> Reporter: Ismaël Mejía
> Priority: Minor
>
> Flink clusters are started automatically in daemon mode, this is definitely
> the default case, however if we want to start containers based on flinks, the
> execution context gets lost. Running flink as foreground processes can fix
> this.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)