Skip to content

Commit a71ee24

Browse files
author
Jacob Ferriero
authored
Merge pull request #45 from jaketf/demo
Demoprep
2 parents 6b2ccb6 + 52d891f commit a71ee24

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1727
-75
lines changed

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@ help: ## Prints help for targets with comments
2424

2525
.PHONY: test
2626
test: ## Test if all files are properly formatted
27-
@$$SHELL ./helpers/check_format.sh && python3 -m flake8 --max-line-length=80 && ./helpers/run_tests.sh
27+
@$$SHELL ./helpers/check_format.sh && python3 -m flake8 --max-line-length=100 && ./helpers/run_tests.sh
2828

2929
.PHONY: precommit
3030
precommit: ## Test if all files are properly formatted
31-
@$$SHELL ./helpers/check_format.sh && python3 -m flake8 --max-line-length=80 && ./helpers/run_relevant_cloudbuilds.sh precommit_cloudbuild.yaml
31+
@$$SHELL ./helpers/check_format.sh && python3 -m flake8 --max-line-length=100 && ./helpers/run_relevant_cloudbuilds.sh precommit_cloudbuild.yaml
3232

3333
.PHONY: push_ci_image
3434
push_ci_image:
35-
@cd ci && gcloud builds submit --project=datapipelines-ci --tag gcr.io/datapipelines-ci/make .
35+
@cd ci && gcloud builds submit --project=datapipelines-ci-282719 --tag gcr.io/datapipelines-ci-282719/make .
3636

3737
.PHONY: push_deploydags_image
3838
push_deploydags_image:
39-
@cd composer/cloudbuild/go/dagsdeployer && gcloud builds submit --project=datapipelines-ci --tag gcr.io/datapipelines-ci/deploydags .
39+
@cd composer/cloudbuild/go/dagsdeployer && gcloud builds submit --project=datapipelines-ci-282719 --tag gcr.io/datapipelines-ci-282719/deploydags .
4040

cd/prod.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ steps:
139139
'deploy-wordcount-jar'
140140
]
141141
args: [
142-
'-dagList=./config/ci_dags.txt',
142+
'-dagList=./config/running_dags.txt',
143143
'-dagsFolder=./dags',
144144
'-project=${PROJECT_ID}',
145145
'-region=${_COMPOSER_REGION}',

ci/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ FROM python:buster
55
# install core tools
66
RUN apt-get update && apt-get install -y build-essential
77

8+
RUN curl -sSL https://sdk.cloud.google.com | bash
9+
810
# install shellcheck
911
RUN apt-get install shellcheck
1012

1113
# install yapf
12-
RUN pip3 install yapf flake8 pytest
14+
RUN pip3 install yapf flake8 pytest apache-airflow[gcp]==1.10.6
1315

1416
# install golang (+gofmt)
1517
RUN apt-get install -y golang

cloudbuild.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ steps:
187187
dir: './composer/cloudbuild/go/dagsdeployer'
188188
args: [
189189
'build',
190-
'-t', 'gcr.io/${_ARTIFACTS_PROJECT_ID}/deploydags:latest',
190+
'-t', 'gcr.io/${PROJECT_ID}/deploydags:latest',
191191
'--cache-from', 'gcr.io/${_ARTIFACTS_PROJECT_ID}/deploydags:latest',
192192
'.'
193193
]
@@ -201,7 +201,7 @@ steps:
201201
'clean-up-data-dir-dags',
202202
]
203203
args: [
204-
'-dagList=./config/ci_dags.txt',
204+
'-dagList=./config/running_dags.txt',
205205
'-dagsFolder=./dags',
206206
'-project=${PROJECT_ID}',
207207
'-region=${_COMPOSER_REGION}',

composer/cloudbuild/bin/run_tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ function install_airflow() {
109109
# $1 relative path to directory containing bigquery sql.
110110
# $2 relative path to JSON file contianing Airflow Variables.
111111
main() {
112-
setup_local_airflow "$1" "$2" "$3"
112+
setup_local_airflow "$1" "$2" "$3"
113113
run_tests
114114
TEST_STATUS=$?
115115
clean_up

composer/cloudbuild/go/dagsdeployer/internal/composerdeployer/composer_ops.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ func readCommentScrubbedLines(path string) ([]string, error) {
195195
lines = append(lines, candidate)
196196
}
197197
}
198-
log.Printf("scrubbed lines: %#v", lines)
199198

200199
return lines, scanner.Err()
201200
}
@@ -212,15 +211,18 @@ func FindDagFilesInLocalTree(dagsRoot string, dagNames map[string]bool) (map[str
212211
// This should map a dir to the ignore patterns in it's airflow ignore if relevant
213212
// this allows us to easily identify the patterns relevant to this dir and it's parents, grandparents, etc.
214213
airflowignoreTree := make(map[string][]string)
215-
files, err := ioutil.ReadDir(dagsRoot)
214+
_, err := ioutil.ReadDir(dagsRoot)
216215
if err != nil {
217216
return matches, fmt.Errorf("error reading dagRoot: %v. %v", dagsRoot, err)
218217
}
219-
log.Printf("found files at dagRott: %v", files)
220218
filepath.Walk(dagsRoot, func(path string, info os.FileInfo, err error) error {
221219
dagID := strings.TrimSuffix(info.Name(), ".py")
222220
relPath, err := filepath.Rel(dagsRoot, path)
223221

222+
if info == nil {
223+
dur, _ := time.ParseDuration("5s")
224+
time.Sleep(dur)
225+
}
224226
// resepect .airflowignore
225227
if info.Name() == ".airflowignore" {
226228
log.Printf("found %v, adding to airflowignoreTree", path)
@@ -325,7 +327,6 @@ func FindDagFilesInLocalTree(dagsRoot string, dagNames map[string]bool) (map[str
325327
}
326328
}
327329
if !alreadyMatched {
328-
log.Printf("new match for %v: %v", dagID, relPath)
329330
matches[dagID] = append(matches[dagID], relPath)
330331
}
331332
}
@@ -461,8 +462,6 @@ func (c *ComposerEnv) stopDag(dag string, relPath string, pauseOnly bool, wg *sy
461462
if err != nil {
462463
return fmt.Errorf("error pausing dag %v: %v", dag, string(out))
463464
}
464-
log.Printf("pauseOnly: %#v", pauseOnly)
465-
log.Printf("!pauseOnly: %#v", !pauseOnly)
466465
if !pauseOnly {
467466
log.Printf("parsing gcs url %v", c.DagBucketPrefix)
468467
gcs, err := url.Parse(c.DagBucketPrefix)

composer/cloudbuild/go/dagsdeployer/internal/gcshasher/gcs_hash.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ func parseGcsPath(gcsPath string) (bucket string, path string, err error) {
4444
}
4545
func gcsMD5(gcsPath string) ([]byte, error) {
4646
bktName, path, err := parseGcsPath(gcsPath)
47-
log.Printf("taking hash of bucket: %s, path: %s", bktName, path)
4847
if err != nil {
4948
log.Fatalf("%s", err)
5049
}

composer/config/AirflowVariables.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,9 @@
66
"gcs_input_bucket": "${INPUT_BUCKET}",
77
"gcs_ref_bucket": "${REF_BUCKET}",
88
"gcs_output_bucket": "${RESULT_BUCKET}",
9-
"dataflow_staging_bucket": "${DATAFLOW_STAGING_BUCKET}"
9+
"dataflow_staging_bucket": "${DATAFLOW_STAGING_BUCKET}",
10+
"dataproc_bucket": "${DATFLOW_STAGING_BUCKET}",
11+
"gce_zone": "${COMPOSER_REGION}-a",
12+
"gcs_bucket": "spark_bucket",
13+
"bq_output_table": "${GCP_PROJECT_ID}.nyc_taxi.avg_speed"
1014
}

composer/config/ci_dags.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

composer/config/running_dags.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
wordcount_dag
2+
tutorial
3+
ephemeral_dataproc_spark_dag
4+
bash_operator
5+
branch_operator
6+
branch_python_dop_operator_3
7+
complex
8+
http_operator
9+
kubernetes_executor_config
10+
latest_only
11+
latest_only_with_trigger
12+
nested_branch_dag
13+
passing_params_via_test_command
14+
pig_operator
15+
python_operator
16+
short_circuit_operator
17+
skip_dag
18+
subdag_operator
19+
trigger_controller_dag
20+
trigger_target_dag
21+
tutorial
22+
xcom

0 commit comments

Comments
 (0)