Skip to content

Commit

Permalink
feat: Onboard MLCommons Multilingual Spoken Words Corpus (MSWC) datas…
Browse files Browse the repository at this point in the history
…et (#252)

* cleanup: Ignores temporary folders

* feat: Adds MLCommons MSWC YAML config

* feat: Adds generated files for MLC MSWC
  • Loading branch information
adlersantos authored Dec 23, 2021
1 parent 48c96f2 commit ec93997
Show file tree
Hide file tree
Showing 7 changed files with 209 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ tmp
/datasets/**/Pipfile
/datasets/**/*.json
/datasets/**/*.tfvars

# ignore temp folders
.tmp
32 changes: 32 additions & 0 deletions datasets/mlcommons/_terraform/mlcommons_dataset.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/


resource "google_storage_bucket" "mswc" {
name = "${var.bucket_name_prefix}-mswc"
force_destroy = true
location = "US"
uniform_bucket_level_access = true
lifecycle {
ignore_changes = [
logging,
]
}
}

output "storage_bucket-mswc-name" {
value = google_storage_bucket.mswc.name
}
28 changes: 28 additions & 0 deletions datasets/mlcommons/_terraform/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/


provider "google" {
project = var.project_id
impersonate_service_account = var.impersonating_acct
region = var.region
}

data "google_client_openid_userinfo" "me" {}

output "impersonating-account" {
value = data.google_client_openid_userinfo.me.email
}
23 changes: 23 additions & 0 deletions datasets/mlcommons/_terraform/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/


variable "project_id" {}
variable "bucket_name_prefix" {}
variable "impersonating_acct" {}
variable "region" {}
variable "env" {}

28 changes: 28 additions & 0 deletions datasets/mlcommons/dataset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

dataset:
name: mlcommons
friendly_name: ~
description: ~
dataset_sources: ~
terms_of_use: ~


resources:

- type: storage_bucket
name: "mswc"
uniform_bucket_level_access: True
location: US
49 changes: 49 additions & 0 deletions datasets/mlcommons/mswc/mswc_dag.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


from airflow import DAG
from airflow.providers.google.cloud.operators import cloud_storage_transfer_service

default_args = {
"owner": "Google",
"depends_on_past": False,
"start_date": "2021-12-01",
}


with DAG(
dag_id="mlcommons.mswc",
default_args=default_args,
max_active_runs=1,
schedule_interval="@monthly",
catchup=False,
default_view="graph",
) as dag:

# Task to run a GCS to GCS operation using Google resources
copy_gcs_bucket = (
cloud_storage_transfer_service.CloudDataTransferServiceGCSToGCSOperator(
task_id="copy_gcs_bucket",
timeout=43200,
retries=0,
wait=True,
project_id="bigquery-public-data",
source_bucket="{{ var.json.mlcommons.mswc.source_bucket }}",
destination_bucket="{{ var.json.mlcommons.mswc.destination_bucket}}",
google_impersonation_chain="{{ var.json.mlcommons.mswc.service_account }}",
)
)

copy_gcs_bucket
46 changes: 46 additions & 0 deletions datasets/mlcommons/mswc/pipeline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---

resources: ~

dag:
airflow_version: 2
initialize:
dag_id: mswc
default_args:
owner: "Google"
depends_on_past: False
start_date: '2021-12-01'
max_active_runs: 1
schedule_interval: "@monthly"
catchup: False
default_view: graph

tasks:
- operator: "CloudDataTransferServiceGCSToGCSOperator"
description: "Task to run a GCS to GCS operation using Google resources"
args:
task_id: copy_gcs_bucket
timeout: 43200 # 12 hours
retries: 0
wait: True
project_id: bigquery-public-data
source_bucket: "{{ var.json.mlcommons.mswc.source_bucket }}"
destination_bucket: "{{ var.json.mlcommons.mswc.destination_bucket}}"
google_impersonation_chain: "{{ var.json.mlcommons.mswc.service_account }}"

graph_paths:
- "copy_gcs_bucket"

0 comments on commit ec93997

Please sign in to comment.