Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have any sense of how common these are? It seems bad for the service to be regularly returning ServerErrors.

Copy link
Contributor Author

@tmatsuo tmatsuo May 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only saw once. I don't know the exact frequency, but it sounds OK to retry all the 5xx errors anyways. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, yeah it is important to track the frequency of 500 errors for sure, but it's the product teams' responsibility.

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