Skip to content

[PLT-1337] Added resource not found error handling to _create #1799

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

Merged
merged 1 commit into from
Sep 12, 2024

Conversation

Gabefire
Copy link
Collaborator

Description

  • Adding this param to the execute makes it raise resource not found errors
  • In the case were prompt creation and MMC projects are made with an invalid dataset_id this will give a better error
  • This param was introduced very recently

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

All Submissions

  • Have you followed the guidelines in our Contributing document?
  • Have you provided a description?
  • Are your changes properly formatted?

@Gabefire Gabefire requested a review from a team as a code owner September 10, 2024 01:46
Copy link
Contributor

@vbrodsky vbrodsky left a comment

Choose a reason for hiding this comment

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

What would be the message when a resource is not found

@Gabefire
Copy link
Collaborator Author

Traceback (most recent call last):
  File "/Users/gabrielunderwood/repos/labelbox-python/test.py", line 9, in <module>
    test = client.create_prompt_response_generation_project(
  File "/Users/gabrielunderwood/repos/labelbox-python/libs/labelbox/src/labelbox/client.py", line 955, in create_prompt_response_generation_project
    return self._create_project(**kwargs)
  File "/Users/gabrielunderwood/repos/labelbox-python/libs/labelbox/src/labelbox/client.py", line 1071, in _create_project
    return self._create(Entity.Project, params, extra_params)
  File "/Users/gabrielunderwood/repos/labelbox-python/libs/labelbox/src/labelbox/client.py", line 640, in _create
    res = self.execute(query_string, params, raise_return_resource_not_found=True)
  File "/Users/gabrielunderwood/repos/labelbox-python/.venv/lib/python3.8/site-packages/google/api_core/retry/retry_unary.py", line 293, in retry_wrapped_func
    return retry_target(
  File "/Users/gabrielunderwood/repos/labelbox-python/.venv/lib/python3.8/site-packages/google/api_core/retry/retry_unary.py", line 153, in retry_target
    _retry_error_helper(
  File "/Users/gabrielunderwood/repos/labelbox-python/.venv/lib/python3.8/site-packages/google/api_core/retry/retry_base.py", line 212, in _retry_error_helper
    raise final_exc from source_exc
  File "/Users/gabrielunderwood/repos/labelbox-python/.venv/lib/python3.8/site-packages/google/api_core/retry/retry_unary.py", line 144, in retry_target
    result = target()
  File "/Users/gabrielunderwood/repos/labelbox-python/libs/labelbox/src/labelbox/client.py", line 309, in execute
    raise labelbox.exceptions.ResourceNotFoundError(
labelbox.exceptions.ResourceNotFoundError: Failed to find dataset: Demo prompt response dataset('Failed to find dataset: Demo prompt response dataset', None)

@Gabefire Gabefire merged commit 11beae0 into develop Sep 12, 2024
18 of 26 checks passed
@Gabefire Gabefire deleted the gu/plt-1337 branch September 12, 2024 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants