Skip to content

Commit

Permalink
[datalabeling] testing: retry upon ServerError
Browse files Browse the repository at this point in the history
  • Loading branch information
Takashi Matsuo committed May 14, 2020
1 parent 2e502b1 commit 793bba5
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions datalabeling/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 datalabeling/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 datalabeling/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 datalabeling/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 datalabeling/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 datalabeling/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 datalabeling/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 793bba5

Please sign in to comment.