Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repro test failures #2662

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions datalabeling/README.rst.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ product:
short_name: Cloud Data Labeling
url: https://cloud.google.com/data-labeling/docs/
description: >
`Google Cloud Data Labeling Service`_ allows developers to request having
human labelers label a collection of data that you plan to use to train a
custom machine learning model.
`Google Cloud Data Labeling Service`_ allows developers to have their
collection of data labeled for use in custom machine learning models.

setup:
- auth
- install_deps

cloud_client_library: true

folder: datalabeling
folder: datalabeling
4 changes: 3 additions & 1 deletion datalabeling/import_data_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,17 @@
import import_data
import manage_dataset
import pytest
import uuid

DISPLAY_NAME = str(uuid.uuid4())
PROJECT_ID = os.getenv('GCLOUD_PROJECT')
INPUT_GCS_URI = 'gs://cloud-samples-data/datalabeling/image/image_dataset.csv'


@pytest.fixture(scope='function')
def dataset():
# create a temporary dataset
dataset = manage_dataset.create_dataset(PROJECT_ID)
dataset = manage_dataset.create_dataset(PROJECT_ID, DISPLAY_NAME)

yield dataset

Expand Down
4 changes: 3 additions & 1 deletion datalabeling/label_image_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,17 @@
import label_image
import manage_dataset
import pytest
import uuid

DISPLAY_NAME = str(uuid.uuid4())
PROJECT_ID = os.getenv('GCLOUD_PROJECT')
INPUT_GCS_URI = 'gs://cloud-samples-data/datalabeling/image/image_dataset.csv'


@pytest.fixture(scope='function')
def dataset():
# create a temporary dataset
dataset = manage_dataset.create_dataset(PROJECT_ID)
dataset = manage_dataset.create_dataset(PROJECT_ID, DISPLAY_NAME)

# import some data to it
import_data.import_data(dataset.name, 'IMAGE', INPUT_GCS_URI)
Expand Down
5 changes: 4 additions & 1 deletion datalabeling/label_text_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,18 @@
import label_text
import manage_dataset
import pytest
import uuid


DISPLAY_NAME = str(uuid.uuid4())
PROJECT_ID = os.getenv('GCLOUD_PROJECT')
INPUT_GCS_URI = 'gs://cloud-samples-data/datalabeling/text/text_dataset.csv'


@pytest.fixture(scope='function')
def dataset():
# create a temporary dataset
dataset = manage_dataset.create_dataset(PROJECT_ID)
dataset = manage_dataset.create_dataset(PROJECT_ID, DISPLAY_NAME)

# import some data to it
import_data.import_data(dataset.name, 'TEXT', INPUT_GCS_URI)
Expand Down
4 changes: 3 additions & 1 deletion datalabeling/label_video_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,17 @@
import label_video
import manage_dataset
import pytest
import uuid

DISPLAY_NAME = str(uuid.uuid4())
PROJECT_ID = os.getenv('GCLOUD_PROJECT')
INPUT_GCS_URI = 'gs://cloud-samples-data/datalabeling/videos/video_dataset.csv'


@pytest.fixture(scope='function')
def dataset():
# create a temporary dataset
dataset = manage_dataset.create_dataset(PROJECT_ID)
dataset = manage_dataset.create_dataset(PROJECT_ID, DISPLAY_NAME)

# import some data to it
import_data.import_data(dataset.name, 'VIDEO', INPUT_GCS_URI)
Expand Down
7 changes: 5 additions & 2 deletions datalabeling/manage_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@


# [START datalabeling_create_dataset_beta]
def create_dataset(project_id):
def create_dataset(
project_id,
display_name='YOUR_ANNOTATION_SPEC_SET_DISPLAY_NAME'):
"""Creates a dataset for the given Google Cloud project."""
from google.cloud import datalabeling_v1beta1 as datalabeling
client = datalabeling.DataLabelingServiceClient()
Expand All @@ -31,11 +33,12 @@ def create_dataset(project_id):
opts = ClientOptions(api_endpoint=os.getenv('DATALABELING_ENDPOINT'))
client = datalabeling.DataLabelingServiceClient(client_options=opts)
# [START datalabeling_create_dataset_beta]
# display_name = 'YOUR_ANNOTATION_SPEC_SET_DISPLAY_NAME'

formatted_project_name = client.project_path(project_id)

dataset = datalabeling.types.Dataset(
display_name='YOUR_ANNOTATION_SPEC_SET_DISPLAY_NAME',
display_name=display_name,
description='YOUR_DESCRIPTION'
)

Expand Down
4 changes: 3 additions & 1 deletion datalabeling/manage_dataset_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@

import manage_dataset
import pytest
import uuid

DISPLAY_NAME = str(uuid.uuid4())
PROJECT_ID = os.getenv("GCLOUD_PROJECT")


@pytest.fixture(scope='function')
def dataset():
# create a temporary dataset
dataset = manage_dataset.create_dataset(PROJECT_ID)
dataset = manage_dataset.create_dataset(PROJECT_ID, DISPLAY_NAME)

yield dataset

Expand Down