Skip to content

Commit 303a3be

Browse files
author
Val Brodsky
committed
Add tests
1 parent 9963a0f commit 303a3be

File tree

3 files changed

+32
-3
lines changed

3 files changed

+32
-3
lines changed

labelbox/schema/model_run.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ def upsert_labels(self,
7777

7878

7979
def _upsert_labels_by_label_ids(self,
80-
label_ids: List[str]):
80+
label_ids: List[str],
81+
timeout_seconds=3600):
8182
mutation_name = 'createMEAModelRunLabelRegistrationTask'
8283
create_task_query_str = """mutation createMEAModelRunLabelRegistrationTaskPyApi($modelRunId: ID!, $labelIds : [ID!]!) {
8384
%s(where : { id : $modelRunId}, data : {labelIds: $labelIds})}
@@ -100,10 +101,11 @@ def _upsert_labels_by_label_ids(self,
100101
timeout_seconds=timeout_seconds)
101102

102103
def _upsert_labels_by_project_id(self,
103-
project_id: str):
104+
project_id: str,
105+
timeout_seconds=3600):
104106
mutation_name = 'createMEAModelRunProjectLabelRegistrationTask'
105107
create_task_query_str = """mutation createMEAModelRunProjectLabelRegistrationTaskPyApi($modelRunId: ID!, $projectId : ID!) {
106-
%s(where : { modelRunId : $modelRunId, projectId: $projectId}}
108+
%s(where : { modelRunId : $modelRunId, projectId: $projectId})}
107109
""" % (mutation_name)
108110

109111
res = self.client.execute(create_task_query_str, {

tests/integration/annotation_import/conftest.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,20 @@ def model_run_with_model_run_data_rows(client, configured_project,
439439
model_run.delete()
440440
# TODO: Delete resources when that is possible ..
441441

442+
@pytest.fixture
443+
def model_run_with_model_run_all_project_data_rows(client, configured_project,
444+
model_run_predictions, model_run):
445+
configured_project.enable_model_assisted_labeling()
446+
447+
upload_task = LabelImport.create_from_objects(
448+
client, configured_project.uid, f"label-import-{uuid.uuid4()}",
449+
model_run_predictions)
450+
upload_task.wait_until_done()
451+
model_run.upsert_labels(project_id=configured_project.uid)
452+
time.sleep(3)
453+
yield model_run
454+
model_run.delete()
455+
# TODO: Delete resources when that is possible ..
442456

443457
class AnnotationImportTestHelpers:
444458

tests/integration/annotation_import/test_mea_prediction_import.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,19 @@ def test_create_from_objects(model_run_with_model_run_data_rows,
3737
annotation_import.input_file_url, object_predictions)
3838
annotation_import.wait_until_done()
3939

40+
def test_create_from_objects_all_project_labels(model_run_with_model_run_all_project_data_rows,
41+
object_predictions,
42+
annotation_import_test_helpers):
43+
name = str(uuid.uuid4())
44+
45+
annotation_import = model_run_with_model_run_all_project_data_rows.add_predictions(
46+
name=name, predictions=object_predictions)
47+
48+
assert annotation_import.model_run_id == model_run_with_model_run_all_project_data_rows.uid
49+
annotation_import_test_helpers.check_running_state(annotation_import, name)
50+
annotation_import_test_helpers.assert_file_content(
51+
annotation_import.input_file_url, object_predictions)
52+
annotation_import.wait_until_done()
4053

4154
def test_create_from_label_objects(model_run_with_model_run_data_rows,
4255
object_predictions,

0 commit comments

Comments
 (0)