-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgo
executable file
·44 lines (36 loc) · 1.69 KB
/
go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
set -e
script_dir=$(cd "$(dirname "$0")" ; pwd -P)
goal_upload-data-source() {
bucket_name="${1}"
if [ -z "${bucket_name}" ]; then
echo "BUCKET_NAME not supplied. Usage <func> bucket_name"
exit 1
fi
ingestion_input_dir="${script_dir}/inputs/data-source"
mkdir -p ${ingestion_input_dir}
curl -o "${ingestion_input_dir}/EmissionsByCountry.csv" "https://raw.githubusercontent.com/data-derp/exercise-co2-vs-temperature-databricks/master/data-ingestion/input-data/EmissionsByCountry.csv"
curl -o "${ingestion_input_dir}/GlobalTemperatures.csv" "https://raw.githubusercontent.com/data-derp/exercise-co2-vs-temperature-databricks/master/data-ingestion/input-data/GlobalTemperatures.csv"
curl -o "${ingestion_input_dir}/TemperaturesByCountry.csv" "https://raw.githubusercontent.com/data-derp/exercise-co2-vs-temperature-databricks/master/data-ingestion/input-data/TemperaturesByCountry.csv"
aws s3 cp ${ingestion_input_dir} s3://${bucket_name}/data-source/ --recursive
}
goal_upload-artifacts() {
bucket_name="${1}"
if [ -z "${bucket_name}" ]; then
echo "BUCKET_NAME not supplied. Usage <func> bucket_name"
exit 1
fi
aws s3 cp ${script_dir}/inputs/data-ingestion/ s3://${bucket_name}/data-ingestion/ --recursive
aws s3 cp ${script_dir}/inputs/data-transformation/ s3://${bucket_name}/data-transformation/ --recursive
}
TARGET=${1:-}
if type -t "goal_${TARGET}" &>/dev/null; then
"goal_${TARGET}" ${@:2}
else
echo "Usage: $0 <goal>
goal:
upload-data-source - Fetches and uploads data-source files to AWS S3 bucket
upload-artifacts - Uploads artifact files to AWS S3 bucket
"
exit 1
fi