-
Notifications
You must be signed in to change notification settings - Fork 68
[PLT-1151] Vb/model setup complete #1685
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
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c295f32
Add Project set_project_model_setup_complete
1cecdc2
Handle out of band exceptions for Project add_model_config in order t…
5e2af6f
Handle model setup complete on model project config deletion
7ceab1e
Use _create_project(), not create_project() for create_offline_model_…
ffd40a4
A more full-proof way to handle unknown exceptions for model setup co…
63090c4
PR feedback + fix tests
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
libs/labelbox/tests/integration/test_project_set_model_setup_complete.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import pytest | ||
|
||
from labelbox.exceptions import LabelboxError, OperationNotAllowedException | ||
|
||
|
||
def test_live_chat_evaluation_project( | ||
live_chat_evaluation_project_with_new_dataset, model_config): | ||
|
||
project = live_chat_evaluation_project_with_new_dataset | ||
|
||
project.set_project_model_setup_complete() | ||
assert bool(project.model_setup_complete) is True | ||
|
||
with pytest.raises( | ||
expected_exception=LabelboxError, | ||
match= | ||
"Cannot create model config for project because model setup is complete" | ||
): | ||
project.add_model_config(model_config.uid) | ||
|
||
|
||
def test_live_chat_evaluation_project_delete_cofig( | ||
live_chat_evaluation_project_with_new_dataset, model_config): | ||
|
||
project = live_chat_evaluation_project_with_new_dataset | ||
project_model_config_id = project.add_model_config(model_config.uid) | ||
assert project_model_config_id | ||
|
||
project_model_config = None | ||
for pmg in project.project_model_configs(): | ||
if pmg.uid == project_model_config_id: | ||
project_model_config = pmg | ||
break | ||
assert project_model_config | ||
|
||
project.set_project_model_setup_complete() | ||
assert bool(project.model_setup_complete) is True | ||
|
||
with pytest.raises( | ||
expected_exception=LabelboxError, | ||
match= | ||
"Cannot create model config for project because model setup is complete" | ||
): | ||
project_model_config.delete() | ||
|
||
|
||
def test_offline_chat_evaluation_project(offline_chat_evaluation_project, | ||
model_config): | ||
|
||
project = offline_chat_evaluation_project | ||
|
||
with pytest.raises( | ||
expected_exception=OperationNotAllowedException, | ||
match= | ||
"Only live model chat evaluation projects can complete model setup" | ||
): | ||
project.set_project_model_setup_complete() | ||
|
||
|
||
def test_any_other_project(project, model_config): | ||
with pytest.raises( | ||
expected_exception=OperationNotAllowedException, | ||
match= | ||
"Only live model chat evaluation projects can complete model setup" | ||
): | ||
project.set_project_model_setup_complete() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import pytest | ||
|
||
from labelbox.exceptions import error_message_for_unparsed_graphql_error | ||
|
||
|
||
@pytest.mark.parametrize('exception_message, expected_result', [ | ||
("Unparsed errors on query execution: [{'message': 'Cannot create model config for project because model setup is complete'}]", | ||
"Cannot create model config for project because model setup is complete"), | ||
("blah blah blah", "Unknown error"), | ||
]) | ||
def test_client_unparsed_exception_messages(exception_message, expected_result): | ||
assert error_message_for_unparsed_graphql_error( | ||
exception_message) == expected_result |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.