Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

Commit

Permalink
[datalabeling] testing: retry upon ServerError [(#3762)](GoogleCloudP…
Browse files Browse the repository at this point in the history
  • Loading branch information
Takashi Matsuo authored May 15, 2020
1 parent 4706e24 commit 4a01785
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions samples/snippets/create_annotation_spec_set_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import os

import backoff
from google.api_core.exceptions import DeadlineExceeded
from google.api_core.exceptions import ServerError
import pytest

import create_annotation_spec_set
Expand All @@ -40,7 +40,7 @@ def cleaner():
def test_create_annotation_spec_set(cleaner, capsys):

@backoff.on_exception(
backoff.expo, DeadlineExceeded, max_time=testing_lib.RETRY_DEADLINE)
backoff.expo, ServerError, max_time=testing_lib.RETRY_DEADLINE)
def run_sample():
return create_annotation_spec_set.create_annotation_spec_set(PROJECT_ID)

Expand Down
4 changes: 2 additions & 2 deletions samples/snippets/create_instruction_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import os

import backoff
from google.api_core.exceptions import DeadlineExceeded
from google.api_core.exceptions import ServerError
import pytest

import create_instruction
Expand All @@ -42,7 +42,7 @@ def cleaner():
def test_create_instruction(cleaner, capsys):

@backoff.on_exception(
backoff.expo, DeadlineExceeded, max_time=testing_lib.RETRY_DEADLINE)
backoff.expo, ServerError, max_time=testing_lib.RETRY_DEADLINE)
def run_sample():
return create_instruction.create_instruction(
PROJECT_ID, 'IMAGE', INSTRUCTION_GCS_URI)
Expand Down
4 changes: 2 additions & 2 deletions samples/snippets/import_data_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import os

import backoff
from google.api_core.exceptions import DeadlineExceeded
from google.api_core.exceptions import ServerError
import pytest

import import_data
Expand All @@ -42,7 +42,7 @@ def dataset():
def test_import_data(capsys, dataset):

@backoff.on_exception(
backoff.expo, DeadlineExceeded, max_time=testing_lib.RETRY_DEADLINE)
backoff.expo, ServerError, max_time=testing_lib.RETRY_DEADLINE)
def run_sample():
import_data.import_data(dataset.name, 'IMAGE', INPUT_GCS_URI)

Expand Down
4 changes: 2 additions & 2 deletions samples/snippets/label_image_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import os

import backoff
from google.api_core.exceptions import DeadlineExceeded
from google.api_core.exceptions import ServerError
import pytest

import label_image
Expand Down Expand Up @@ -80,7 +80,7 @@ def test_label_image(
capsys, annotation_spec_set, instruction, dataset, cleaner):

@backoff.on_exception(
backoff.expo, DeadlineExceeded, max_time=testing_lib.RETRY_DEADLINE)
backoff.expo, ServerError, max_time=testing_lib.RETRY_DEADLINE)
def run_sample():
# Start labeling.
return label_image.label_image(
Expand Down
4 changes: 2 additions & 2 deletions samples/snippets/label_text_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import os

import backoff
from google.api_core.exceptions import DeadlineExceeded
from google.api_core.exceptions import ServerError
import pytest

import label_text
Expand Down Expand Up @@ -80,7 +80,7 @@ def cleaner():
def test_label_text(capsys, annotation_spec_set, instruction, dataset, cleaner):

@backoff.on_exception(
backoff.expo, DeadlineExceeded, max_time=testing_lib.RETRY_DEADLINE)
backoff.expo, ServerError, max_time=testing_lib.RETRY_DEADLINE)
def run_sample():
# Start labeling.
return label_text.label_text(
Expand Down
4 changes: 2 additions & 2 deletions samples/snippets/label_video_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import os

import backoff
from google.api_core.exceptions import DeadlineExceeded
from google.api_core.exceptions import ServerError
import pytest

import label_video
Expand Down Expand Up @@ -80,7 +80,7 @@ def test_label_video(
capsys, annotation_spec_set, instruction, dataset, cleaner):

@backoff.on_exception(
backoff.expo, DeadlineExceeded, max_time=testing_lib.RETRY_DEADLINE)
backoff.expo, ServerError, max_time=testing_lib.RETRY_DEADLINE)
def run_sample():
# Start labeling.
return label_video.label_video(
Expand Down
10 changes: 5 additions & 5 deletions samples/snippets/manage_dataset_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
import os

import backoff
from google.api_core.exceptions import DeadlineExceeded
from google.api_core.exceptions import RetryError
from google.api_core.exceptions import ServerError
import pytest

import manage_dataset
Expand Down Expand Up @@ -60,7 +60,7 @@ def cleaner():
def test_create_dataset(cleaner, capsys):

@backoff.on_exception(
backoff.expo, DeadlineExceeded, max_time=testing_lib.RETRY_DEADLINE)
backoff.expo, ServerError, max_time=testing_lib.RETRY_DEADLINE)
def run_sample():
return manage_dataset.create_dataset(PROJECT_ID)

Expand All @@ -75,7 +75,7 @@ def run_sample():
def test_list_dataset(capsys, dataset):

@backoff.on_exception(
backoff.expo, DeadlineExceeded, max_time=testing_lib.RETRY_DEADLINE)
backoff.expo, ServerError, max_time=testing_lib.RETRY_DEADLINE)
def run_sample():
manage_dataset.list_datasets(PROJECT_ID)

Expand All @@ -86,7 +86,7 @@ def run_sample():

def test_get_dataset(capsys, dataset):
@backoff.on_exception(
backoff.expo, DeadlineExceeded, max_time=testing_lib.RETRY_DEADLINE)
backoff.expo, ServerError, max_time=testing_lib.RETRY_DEADLINE)
def run_sample():
manage_dataset.get_dataset(dataset.name)

Expand All @@ -97,7 +97,7 @@ def run_sample():

def test_delete_dataset(capsys, dataset):
@backoff.on_exception(
backoff.expo, DeadlineExceeded, max_time=testing_lib.RETRY_DEADLINE)
backoff.expo, ServerError, max_time=testing_lib.RETRY_DEADLINE)
def run_sample():
manage_dataset.delete_dataset(dataset.name)

Expand Down

0 comments on commit 4a01785

Please sign in to comment.