Parcourir la source

feat:添加脚本

zhaohaipeng il y a 7 mois
Parent
commit
a7d5c8811c
1 fichiers modifiés avec 7 ajouts et 10 suppressions
  1. 7 10
      ad/01_ad_model_update.sh

+ 7 - 10
ad/01_ad_model_update.sh

@@ -2,8 +2,8 @@
 set -x
 
 # source /root/anaconda3/bin/activate py37
-
-source ./00_common.sh
+sh_path=$(pwd)
+source ${sh_path}/00_common.sh
 
 export SPARK_HOME=/opt/apps/SPARK2/spark-2.4.8-hadoop3.2-1.0.8
 export PATH=$SPARK_HOME/bin:$PATH
@@ -22,15 +22,13 @@ today_early_1="$(date -d '1 days ago' +%Y%m%d)"
 train_dates=()
 
 init() {
-  local count=0
-  local current_handle_date="$(date -d '2 days ago' +%Y%m%d)"
+  local count=
+  local handle_date="$(date -d '2 days ago' +%Y%m%d)"
 
   # 循环获取前 n 天的非节日日期
   while [[ $count -lt 7 ]]; do
     # 获取当前日期的 MM-DD 部分
-    date_key=$(date -d "$current_handle_date -${count} day" +%Y%m%d)
-
-    echo "date_key: ${date_key}"
+    date_key=$(date -d "$handle_date -${count} day" +%Y%m%d)
 
     # 判断是否是节日
     if [ $(is_holidays $date_key) -ge 0 ]; then
@@ -39,11 +37,10 @@ init() {
       # 计数器加 1
       count=$((count + 1))
     fi
-
-    # 日期递减 1 天
-    # current_handle_date=$(date -d "$current_handle_date -$ day" +%Y%m%d)
   done
 
+  echo "train_dates: ${train_dates[@]}"
+
 }