Skip to content

Commit

Permalink
[hotfix][dist] Export variables in only one place (config.sh)
Browse files Browse the repository at this point in the history
Previously exporting of variables like FLINK_CONF_DIR, FLINK_BIN_DIR, FLINK_LIB_DIR, ...
was scattered or even dupliacted in multiple places. Now it happens only in config.sh.
  • Loading branch information
pnowojski committed Jun 13, 2019
1 parent d14117f commit 9871f25
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 26 deletions.
14 changes: 8 additions & 6 deletions flink-dist/src/main/flink-bin/bin/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -300,12 +300,6 @@ FLINK_HOME=`dirname "$SYMLINK_RESOLVED_BIN"`
FLINK_LIB_DIR=$FLINK_HOME/lib
FLINK_OPT_DIR=$FLINK_HOME/opt

### Exported environment variables ###
export FLINK_CONF_DIR
# export /lib dir to access it during deployment of the Yarn staging files
export FLINK_LIB_DIR
# export /opt dir to access it for the SQL client
export FLINK_OPT_DIR

# These need to be mangled because they are directly passed to java.
# The above lib path is used by the shell script to retrieve jars in a
Expand All @@ -317,6 +311,14 @@ DEFAULT_FLINK_LOG_DIR=$FLINK_HOME_DIR_MANGLED/log
FLINK_CONF_FILE="flink-conf.yaml"
YAML_CONF=${FLINK_CONF_DIR}/${FLINK_CONF_FILE}

### Exported environment variables ###
export FLINK_CONF_DIR
export FLINK_BIN_DIR
# export /lib dir to access it during deployment of the Yarn staging files
export FLINK_LIB_DIR
# export /opt dir to access it for the SQL client
export FLINK_OPT_DIR

########################################################################################################################
# ENVIRONMENT VARIABLES
########################################################################################################################
Expand Down
3 changes: 0 additions & 3 deletions flink-dist/src/main/flink-bin/bin/flink
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,5 @@ CC_CLASSPATH=`constructFlinkClassPath`
log=$FLINK_LOG_DIR/flink-$FLINK_IDENT_STRING-client-$HOSTNAME.log
log_setting=(-Dlog.file="$log" -Dlog4j.configuration=file:"$FLINK_CONF_DIR"/log4j-cli.properties -Dlogback.configurationFile=file:"$FLINK_CONF_DIR"/logback.xml)

export FLINK_HOME
export FLINK_CONF_DIR

# Add HADOOP_CLASSPATH to allow the usage of Hadoop file systems
exec $JAVA_RUN $JVM_ARGS "${log_setting[@]}" -classpath "`manglePathList "$CC_CLASSPATH:$INTERNAL_HADOOP_CLASSPATHS"`" org.apache.flink.client.cli.CliFrontend "$@"
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ CC_CLASSPATH=`manglePathList $(constructFlinkClassPath):$INTERNAL_HADOOP_CLASSPA
log="${FLINK_LOG_DIR}/flink-${FLINK_IDENT_STRING}-mesos-appmaster-${HOSTNAME}.log"
log_setting="-Dlog.file="$log" -Dlog4j.configuration=file:"$FLINK_CONF_DIR"/log4j.properties -Dlogback.configurationFile=file:"$FLINK_CONF_DIR"/logback.xml"

export FLINK_CONF_DIR
export FLINK_BIN_DIR
export FLINK_LIB_DIR

exec $JAVA_RUN $JVM_ARGS -classpath "$CC_CLASSPATH" $log_setting org.apache.flink.mesos.entrypoint.MesosJobClusterEntrypoint "$@"

rc=$?
Expand Down
4 changes: 0 additions & 4 deletions flink-dist/src/main/flink-bin/mesos-bin/mesos-appmaster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ CC_CLASSPATH=`manglePathList $(constructFlinkClassPath):$INTERNAL_HADOOP_CLASSPA
log="${FLINK_LOG_DIR}/flink-${FLINK_IDENT_STRING}-mesos-appmaster-${HOSTNAME}.log"
log_setting="-Dlog.file="$log" -Dlog4j.configuration=file:"$FLINK_CONF_DIR"/log4j.properties -Dlogback.configurationFile=file:"$FLINK_CONF_DIR"/logback.xml"

export FLINK_CONF_DIR
export FLINK_BIN_DIR
export FLINK_LIB_DIR

ENTRY_POINT=org.apache.flink.mesos.entrypoint.MesosSessionClusterEntrypoint

exec $JAVA_RUN $JVM_ARGS -classpath "$CC_CLASSPATH" $log_setting ${ENTRY_POINT} "$@"
Expand Down
4 changes: 0 additions & 4 deletions flink-dist/src/main/flink-bin/mesos-bin/mesos-taskmanager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ export FLINK_ENV_JAVA_OPTS="${FLINK_ENV_JAVA_OPTS} ${FLINK_ENV_JAVA_OPTS_MEM}"
# Add TaskManager-specific JVM options
export FLINK_ENV_JAVA_OPTS="${FLINK_ENV_JAVA_OPTS} ${FLINK_ENV_JAVA_OPTS_TM}"

export FLINK_CONF_DIR
export FLINK_BIN_DIR
export FLINK_LIB_DIR

ENTRY_POINT=org.apache.flink.mesos.entrypoint.MesosTaskExecutorRunner

exec $JAVA_RUN $JVM_ARGS ${FLINK_ENV_JAVA_OPTS} -classpath "$CC_CLASSPATH" $log_setting ${ENTRY_POINT} "$@"
Expand Down
2 changes: 0 additions & 2 deletions flink-dist/src/main/flink-bin/yarn-bin/yarn-session.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,5 @@ CC_CLASSPATH=`manglePathList $(constructFlinkClassPath):$INTERNAL_HADOOP_CLASSPA
log=$FLINK_LOG_DIR/flink-$FLINK_IDENT_STRING-yarn-session-$HOSTNAME.log
log_setting="-Dlog.file="$log" -Dlog4j.configuration=file:"$FLINK_CONF_DIR"/log4j-yarn-session.properties -Dlogback.configurationFile=file:"$FLINK_CONF_DIR"/logback-yarn.xml"

export FLINK_CONF_DIR

$JAVA_RUN $JVM_ARGS -classpath "$CC_CLASSPATH" $log_setting org.apache.flink.yarn.cli.FlinkYarnSessionCli -j "$FLINK_LIB_DIR"/flink-dist*.jar "$@"

3 changes: 0 additions & 3 deletions flink-table/flink-sql-client/bin/sql-client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ CC_CLASSPATH=`constructFlinkClassPath`
log=$FLINK_LOG_DIR/flink-$FLINK_IDENT_STRING-sql-client-$HOSTNAME.log
log_setting=(-Dlog.file="$log" -Dlog4j.configuration=file:"$FLINK_CONF_DIR"/log4j-cli.properties -Dlogback.configurationFile=file:"$FLINK_CONF_DIR"/logback.xml)

export FLINK_HOME
export FLINK_CONF_DIR

# get path of jar in /opt if it exist
FLINK_SQL_CLIENT_JAR=$(find "$FLINK_OPT_DIR" -regex ".*flink-sql-client.*.jar")

Expand Down

0 comments on commit 9871f25

Please sign in to comment.