Skip to content

Commit

Permalink
Merge pull request #829 from WeBankFinTech/dev-1.0.0
Browse files Browse the repository at this point in the history
[release] Prepare for release Linkis-1.0.0
  • Loading branch information
sargentti authored Jun 29, 2021
2 parents ddd5977 + 847a02a commit da37165
Show file tree
Hide file tree
Showing 2,595 changed files with 120,294 additions and 19,592 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ linkis-commons/linkis-rpc/target/
linkis-commons/linkis-scheduler/target/
linkis-commons/linkis-storage/target/

linkis-computation-governance/linkis-computation-client/target/
linkis-computation-governance/linkis-client/linkis-cli/linkis-cli-application/target/
linkis-computation-governance/linkis-client/linkis-cli/linkis-cli-core/target/
linkis-computation-governance/linkis-client/linkis-cli/linkis-cli-common/target/
linkis-computation-governance/linkis-client/linkis-computation-client/target/
linkis-computation-governance/linkis-computation-governance-common/target/
linkis-computation-governance/linkis-engineconn-manager/linkis-engineconn-linux-launch/target/
linkis-computation-governance/linkis-engineconn-manager/linkis-engineconn-manager-core/target/
Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ As a computation middleware, Linkis provides powerful connectivity, reuse, orche
Since the first release of Linkis in 2019, it has accumulated more than **700** trial companies and **1000+** sandbox trial users, which involving diverse industries, from finance, banking, tele-communication, to manufactory, internet companies and so on. Lots of companies have already used Linkis as a unified entrance for the underlying computation and storage engines of the big data platform.


![linkis-intro-01](https://user-images.githubusercontent.com/11496700/84615498-c3030200-aefb-11ea-9b16-7e4058bf6026.png)
![linkis-intro-01](images/linkis-intro-01.png)

![linkis-intro-03](https://user-images.githubusercontent.com/11496700/84615483-bb435d80-aefb-11ea-81b5-67f62b156628.png)
![linkis-intro-03](images/linkis-intro-03.png)

# Features

Expand Down Expand Up @@ -58,7 +58,8 @@ Please go to the [Linkis releases page](https://github.com/WeBankFinTech/Linkis/

# Compile and deploy
Please follow [Compile Guide](https://github.com/WeBankFinTech/Linkis-Doc/blob/master/en_US/Development_Documents/Linkis_Compilation_Document.md) to compile Linkis from source code.
Please refer to [Deployment_Documents](https://github.com/WeBankFinTech/Linkis-Doc/tree/master/en_US/Deployment_Documents) to do the deployment.
Please refer to [Deployment_Documents](https://github.com/WeBankFinTech/Linkis-Doc/tree/master/en_US/Deployment_Documents) to do the deployment.


# Examples and Guidance
You can find examples and guidance for how to use and manage Linkis in [User_Manual](https://github.com/WeBankFinTech/Linkis-Doc/tree/master/en_US/User_Manual), [Engine_Usage_Documents](https://github.com/WeBankFinTech/Linkis-Doc/tree/master/en_US/Engine_Usage_Documentations) and [API_Documents](https://github.com/WeBankFinTech/Linkis-Doc/tree/master/en_US/API_Documentations).
Expand All @@ -68,9 +69,9 @@ You can find examples and guidance for how to use and manage Linkis in [User_Man
The documentation of linkis is in [Linkis-Doc](https://github.com/WeBankFinTech/Linkis-Doc).

# Architecture
Linkis services could be divided into three categories: computation governance services, public enhancement services and microservice governance services.
- The computation governance services, support the 3 major stages of processing a task/request: submission -> preparation -> execution;
- The public enhancement services, including the material library service, context service, and data source service;
Linkis services could be divided into three categories: computation governance services, public enhancement services and microservice governance services.
- The computation governance services, support the 3 major stages of processing a task/request: submission -> preparation -> execution;
- The public enhancement services, including the material library service, context service, and data source service;
- The microservice governance services, including Spring Cloud Gateway, Eureka and Open Feign.

Below is the Linkis architecture diagram. You can find more detailed architecture docs in [Linkis-Doc/Architecture](https://github.com/WeBankFinTech/Linkis-Doc/tree/master/en_US/Architecture_Documents).
Expand Down
104 changes: 104 additions & 0 deletions assembly-combined-package/assembly-combined/bin/linkis-cli
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
#!/bin/bash
#
# Copyright 2019 WeBank
#
# 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.
#

#set -x
export LANG=en_US.utf-8
LINKIS_CLIENT='com.webank.wedatasphere.linkis.cli.application.LinkisClientApplication'

i=0
for arg in "$@"
do
args[i]=${arg}
input_args[i]=${arg}
((i++))
done


#===============================================
# finf java_home
#===============================================
locate_java_home() {
local JAVA8_HOME_CANDIDATES='\
/usr/java/jdk1.8* \
/nemo/jdk1.8*'

JAVA_HOME_CANDIDATES="$JAVA8_HOME_CANDIDATES"

# attempt to find java 8
flag=""
for candidate_regex in $JAVA_HOME_CANDIDATES ; do
for candidate in `ls -rd $candidate_regex 2>/dev/null`; do
if [ -e $candidate/bin/java ]; then
export JAVA_HOME=$candidate
flag="true"
break 2
fi
done
done

if [ -z "$flag" ]; then
echo -e "\033[0;31;40mNo JDK 8 found. linkis-client requires Java 1.8\033[0m" 1>&2
exit 1
fi

verify_java_home
}

# Verify that JAVA_HOME set - does not verify that it's set to a meaningful
# value.
verify_java_home() {
if [ -z "$JAVA_HOME" ]; then
cat 1>&2 <<EOF
+======================================================================+
| Error: JAVA_HOME is not set and Java could not be found |
+----------------------------------------------------------------------+
EOF
exit 1
fi
}


function call_linkis_client() {
current_dir=`pwd`
workdir=`dirname "$0"`/../
workdir=`cd ${workdir};pwd`
cd ${current_dir}

LINKIS_DEPLOY_LIB_DIR='lib/linkis-computation-governance/linkis-client/linkis-cli/'
LINKIS_DEPLOY_CONF_DIR='conf/linkis-cli'
LINKIS_DEPLOY_LOG_DIR='logs/linkis-cli'
LINKIS_CLIENT_CLASSPATH=${workdir}/${LINKIS_DEPLOY_CONF_DIR}:${workdir}/${LINKIS_DEPLOY_LIB_DIR}*:${CLASSPATH}
LINKIS_CLIENT_LOG_DIR=${LINKIS_CLIENT_LOG_DIR:-"${workdir}/${LINKIS_DEPLOY_LOG_DIR}"}
LINKIS_CLIENT_CONF_DIR=${LINKIS_CLIENT_CONF_DIR:-"${workdir}/${LINKIS_DEPLOY_CONF_DIR}"}
LINKIS_CLIENT_CONF_FILE=${LINKIS_CLIENT_CONF_FILE:-"linkis-cli.properties"}

LINKIS_CLIENT_HEAP_OPTS="-server -Xms32m -Xmx2048m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${LINKIS_CLIENT_LOG_DIR} -XX:ErrorFile=${LINKIS_CLIENT_LOG_DIR}/ps_err_pid%p.log"
LINKIS_CLIENT_GC_OPTS="-XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=80 -XX:+DisableExplicitGC"
LINKIS_CLIENT_LOG_OPTS="-Dlog.path=${LINKIS_CLIENT_LOG_DIR} -Dlog.file=linkis-client.${USER}.log.`date '+%Y%m%d%H%M%S%N'`"
#DEBUG_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"
LINKIS_CLIENT_OPTS=${LINKIS_CLIENT_OPTS:-" ${DEBUG_OPTS} "}



exec ${JAVA} ${LINKIS_CLIENT_HEAP_OPTS} ${LINKIS_CLIENT_GC_OPTS} ${LINKIS_CLIENT_OPTS} -classpath ${LINKIS_CLIENT_CLASSPATH} -Dconf.root=${LINKIS_CLIENT_CONF_DIR} -Dconf.file=${LINKIS_CLIENT_CONF_FILE} ${LINKIS_CLIENT_LOG_OPTS} ${LINKIS_CLIENT} "${input_args[@]}"
}


locate_java_home
JAVA=${JAVA_HOME}/bin/java

call_linkis_client
187 changes: 187 additions & 0 deletions assembly-combined-package/assembly-combined/bin/linkis-cli-hive
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
#!/bin/bash
#
# Copyright 2019 WeBank
#
# 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.
#

# set -x
export LANG=en_US.utf-8
declare -A ord_opts=(\
#cli options
['-e']='-code' \
['-f']='-codePath' \
# ['-i']=true \ #not supported
# ['-S']=true \ #not supported
# ['--silent']=true \ #not supported
# ['-v']=true \ #not supported
# ['--verbose']=true \ #not supported
['--hiveconf']='-confMap' \
['-d']='-varMap' \
['--hivevar']='-varMap' \
#linkis opts
['--kill']='--kill' \
['--status']='--status' \
)

#options that should be put in confMap(startupMap)
declare -A confMap_opts=(\
#cli options
# ['--database']='k_db' \
)

#options that should be put in varMap(for variable substitution)
declare -A kv_var_opts=(\
['-d']=true \
['--hivevar']=true \
)

#k-v pairs style options
declare -A kv_conf_opts=(\
['--hiveconf']=true \
)

# for help
declare -A help_opts=(\
['-H']='--help' \
['--help']='--help' \
)

declare -A help_msg=(\
['-d']="Variable subsitution to apply to hive commands. e.g. -d A=B or --define A=B"
#['--database']="Specify the database to use" \
['-e']="SQL from command line" \
['-f']="SQL from files" \
['-H,--help']="Print help information" \
['--hiveconf']="Use value for given property" \
['--hivevar']="Variable subsitution to apply to hive commands. e.g. --hivevar A=B" \
['--kill']="--kill" \
['--status']="--status" \
)

function print_help() {
printf "Usage:\n"
for key in $(echo ${!help_msg[*]})
do
if [ -n "${help_msg[${key}]}" ]; then
msg=${help_msg[${key}]}
len=${#msg}
printf " %-30s%-30s\n" "$key" "${msg: 0:50}"
for ((i=50;i<len;i+=50))
do
if (( i+50<len )); then
printf " %-30s%-30s\n" "" "${msg: i:50}"
else
printf " %-30s%-30s\n" "" "${msg: i}"
fi

done

fi
done
}



i=0
for arg in "$@"
do
ARGS[i]=${arg}
((i++))
done
NUM_ARGS=$i

CONFMAP_OPTS=""
VARMAP_OPTS=""
LABELMAP_OPTS=""
REMAINS_STR=""
declare -a PARSED_CMD
j=0

function parse() {
for((i=0;i<NUM_ARGS;i++));
do
arg=${ARGS[${i}]}
if [ -n "${help_opts[${arg}]}" ]; then
print_help
PARSED_CMD[$j]=${help_opts[${arg}]}
break
fi
if [ $((${i}+1)) -lt ${NUM_ARGS} ]; then
val=${ARGS[${i}+1]}
if [ -n "${ord_opts[${arg}]}" ]; then
lks_opt=${ord_opts[${arg}]}
PARSED_CMD[$j]=$lks_opt
PARSED_CMD[$j+1]=$val
((j=j+2))
elif [ -n "${kv_conf_opts[${arg}]}" ]; then
kv_str=$val
if [ -n "${CONFMAP_OPT}" ]; then
CONFMAP_OPT=$CONFMAP_OPT","$kv_str
else
CONFMAP_OPT=$kv_str
fi
elif [ -n "${kv_var_opts[${arg}]}" ]; then
kv_str=$val
if [ -n "${VARMAP_OPTS}" ]; then
VARMAP_OPTS=$VARMAP_OPTS","$kv_str
else
VARMAP_OPTS=$kv_str
fi
elif [ -n "${confMap_opts[${arg}]}" ]; then
key=${confMap_opts[${arg}]}
kv_str=$key"="$val
if [ -n "${CONFMAP_OPT}" ]; then
CONFMAP_OPT=$CONFMAP_OPT","$kv_str
else
CONFMAP_OPT=$kv_str
fi
else
PARSED_CMD[$j]=$arg
PARSED_CMD[$j+1]=$val
((j=j+2))
fi
((i++))
else
PARSED_CMD[$j]=$arg
((j++))
fi
done
if [ -n "${CONFMAP_OPT}" ]; then
PARSED_CMD[$j]="-confMap"
PARSED_CMD[$j+1]=$CONFMAP_OPT
((j=j+2))
fi
if [ -n "${VARMAP_OPTS}" ]; then
PARSED_CMD[$j]="-varMap"
PARSED_CMD[$j+1]=$VARMAP_OPTS
((j=j+2))
fi
}


current_dir=`pwd`
if [ -n $WORK_DIR ]; then
work_dir=`dirname "$0"`/../
export WORK_DIR=`cd ${work_dir};pwd`
fi
cd ${current_dir}/
if (( NUM_ARGS == 0 )); then
PARSED_CMD[$j]='--help'
print_help
else
parse
fi
exec ${WORK_DIR}/bin/linkis-cli-start -engineType hive-1.2.1 -codeType hql "${PARSED_CMD[@]}"


Loading

0 comments on commit da37165

Please sign in to comment.