#!/bin/sh

#MVN_PACKAGE="mvn clean install  -T 2C -Dmaven.test.skip=true -Dmaven.compile.fork=true"
JAVA_PATH="/usr/bin/java"
PYTHON_PATH="/usr/bin/python"
UPLOAD_PY_PATH="/root/algo/upload.py"
JAR_PATH="/root/algo/recommend-server/recommend-server-service/target/recommend-server-service.jar"
FM_PATH="/root/algo/alphaFM/bin"
MODEL_PATH="/root/algo/LR_MODEL/"
YESTERDAY="$(date -d '2 days ago' +%Y%m%d)"
LAST30DAY="$(date -d '2 days ago' +%Y%m%d)"
MAIN_CLASS="com.tzld.piaoquan.recommend.server.dataloader.OfflineShareSamplesLoader"
TABLE_NAME="loghubods.alg_recsys_view_sample"
LABEL="share_ornot"
#OSSPATH=""


# Train
#mkdir -p ${MODEL_PATH}/${YESTERDAY}
#${JAVA_PATH} -jar ${JAR_PATH} ${TABLE_NAME} ${LAST30DAY} ${YESTERDAY} ${LABEL} | ${FM_PATH}/fm_train -m ${MODEL_PATH}/${YESTERDAY}/model_${YESTERDAY}.txt -dim 0,1,0 -core 8

#cat ${MODEL_PATH}/${YESTERDAY}/model_${YESTERDAY}.txt | awk -F " " '{print $1,"\t",$2}' > ${MODEL_PATH}/${YESTERDAY}/model_${YESTERDAY}_new.txt

# Upload
#${UPLOAD_PY_PATH} ${MODEL_PATH}/${YESTERDAY}/model_${YESTERDAY}_new.txt ${OSSPATH}

# Predict
java -jar ${JAR_PATH} $TABLE_NAME 20231211 20231211 ${LABEL}| ${FM_PATH}/fm_predict -m ${MODEL_PATH}/20231210/model_20231210.txt  -dim 0 -core 8 -out ${MODEL_PATH}/predict_1211.txt