Skip to content

Commit 0c28563

Browse files
authored
Feat: Onboard Celeba dataset (#420)
1 parent 27b0a9b commit 0c28563

File tree

5 files changed

+163
-0
lines changed

5 files changed

+163
-0
lines changed

datasets/celeba/infra/provider.tf

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/**
2+
* Copyright 2021 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
18+
provider "google" {
19+
project = var.project_id
20+
impersonate_service_account = var.impersonating_acct
21+
region = var.region
22+
}
23+
24+
data "google_client_openid_userinfo" "me" {}
25+
26+
output "impersonating-account" {
27+
value = data.google_client_openid_userinfo.me.email
28+
}

datasets/celeba/infra/variables.tf

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* Copyright 2021 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
18+
variable "project_id" {}
19+
variable "bucket_name_prefix" {}
20+
variable "impersonating_acct" {}
21+
variable "region" {}
22+
variable "env" {}
23+
variable "iam_policies" {
24+
default = {}
25+
}
26+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Copyright 2021 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
16+
from airflow import DAG
17+
from airflow.providers.google.cloud.transfers import gcs_to_gcs
18+
19+
default_args = {
20+
"owner": "Google",
21+
"depends_on_past": False,
22+
"start_date": "2022-07-20",
23+
}
24+
25+
26+
with DAG(
27+
dag_id="celeba.celeba",
28+
default_args=default_args,
29+
max_active_runs=1,
30+
schedule_interval="@once",
31+
catchup=False,
32+
default_view="graph",
33+
) as dag:
34+
35+
# Transfer data from source to destination in GCS
36+
GCStoGCS_transfer = gcs_to_gcs.GCSToGCSOperator(
37+
task_id="GCStoGCS_transfer",
38+
source_bucket="{{ var.json.celeba.source_bucket }}",
39+
source_object="{{ var.json.celeba.source_object }}",
40+
destination_bucket="{{ var.json.celeba.destination_bucket }}",
41+
destination_object="{{ var.json.celeba.destination_object }}",
42+
)
43+
44+
GCStoGCS_transfer
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Copyright 2021 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
---
16+
resources: ~
17+
18+
dag:
19+
airflow_version: 2
20+
initialize:
21+
dag_id: celeba
22+
default_args:
23+
owner: "Google"
24+
depends_on_past: False
25+
start_date: "2022-07-20"
26+
max_active_runs: 1
27+
schedule_interval: "@once"
28+
catchup: False
29+
default_view: graph
30+
31+
tasks:
32+
- operator: "GoogleCloudStorageToGoogleCloudStorageOperator"
33+
description: "Transfer data from source to destination in GCS"
34+
args:
35+
task_id: "GCStoGCS_transfer"
36+
source_bucket: "{{ var.json.celeba.source_bucket }}"
37+
source_object: "{{ var.json.celeba.source_object }}"
38+
destination_bucket: "{{ var.json.celeba.destination_bucket }}"
39+
destination_object: "{{ var.json.celeba.destination_object }}"
40+
41+
graph_paths:
42+
- "GCStoGCS_transfer"
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright 2021 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
dataset:
16+
name: celeba
17+
friendly_name: Celebrity Attributes
18+
description: Dataset of images of the facial attributes of various celebrities.
19+
dataset_sources: ~
20+
terms_of_use: ~
21+
22+
23+
resources: ~

0 commit comments

Comments
 (0)