#! /bin/env bash


date_type=$2
date_info=$3
hive_table=dwt_fd_category_agg
hive_level=dwt

if [ $1 == all ];
then
        site_name_array=(us uk de es fr it)
else
        site_name_array=($1)
fi

flag=1

for site_name in ${site_name_array[*]}
	do
		echo "site_name: ${site_name}","date_type: ${date_type}","date_info: ${date_info}"
		echo "hive_table: ${hive_table}"
		hdfs dfs -rm -r /home/big_data_selection/${hive_level}/${hive_table}/site_name=${site_name}/date_type=${date_type}/date_info=${date_info}/*
		# 放到yarn执行
		/opt/module/spark/bin/spark-submit \
		--master yarn \
		--driver-memory 10g \
		--executor-memory 10g \
		--executor-cores 4 \
		--num-executors 20 \
		--queue spark \
		/opt/module/spark/demo/py_demo/${hive_level}/${hive_table}.py ${site_name} ${date_type} ${date_info}
	done

