Skip to content

Commit ceb8a1d

Browse files
authored
Merge pull request #154 from Labelbox/ms/remove-datarow-validation
remove data row validation
2 parents ff2cd38 + def32d4 commit ceb8a1d

File tree

2 files changed

+3
-19
lines changed

2 files changed

+3
-19
lines changed

labelbox/schema/bulk_import_request.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -407,15 +407,12 @@ def _validate_ndjson(lines: Iterable[Dict[str, Any]],
407407
MALValidationError: Raise for invalid NDJson
408408
UuidError: Duplicate UUID in upload
409409
"""
410-
export_url = project.export_queued_data_rows()
411-
data_row_json = ndjson.loads(requests.get(export_url).text)
412-
data_row_ids = {row['id'] for row in data_row_json}
413410
feature_schemas = get_mal_schemas(project.ontology())
414411
uids: Set[str] = set()
415412
for idx, line in enumerate(lines):
416413
try:
417414
annotation = NDAnnotation(**line)
418-
annotation.validate_instance(data_row_ids, feature_schemas)
415+
annotation.validate_instance(feature_schemas)
419416
uuid = str(annotation.uuid)
420417
if uuid in uids:
421418
raise labelbox.exceptions.UuidError(
@@ -595,12 +592,6 @@ class NDBase(NDFeatureSchema):
595592
uuid: UUID
596593
dataRow: DataRow
597594

598-
def validate_datarow(self, valid_datarows):
599-
if self.dataRow.id not in valid_datarows:
600-
raise ValueError(
601-
f"datarow {self.dataRow.id} is not attached to the specified project"
602-
)
603-
604595
def validate_feature_schemas(self, valid_feature_schemas):
605596
if self.schemaId not in valid_feature_schemas:
606597
raise ValueError(
@@ -612,9 +603,8 @@ def validate_feature_schemas(self, valid_feature_schemas):
612603
f"Schema id {self.schemaId} does not map to the assigned tool {valid_feature_schemas[self.schemaId]['tool']}"
613604
)
614605

615-
def validate_instance(self, valid_datarows, valid_feature_schemas):
606+
def validate_instance(self, valid_feature_schemas):
616607
self.validate_feature_schemas(valid_feature_schemas)
617-
self.validate_datarow(valid_datarows)
618608

619609
class Config:
620610
#Users shouldn't to add extra data to the payload
@@ -694,6 +684,7 @@ class NDBaseTool(NDBase):
694684

695685
#This is indepdent of our problem
696686
def validate_feature_schemas(self, valid_feature_schemas):
687+
super(NDBaseTool, self).validate_feature_schemas(valid_feature_schemas)
697688
for classification in self.classifications:
698689
classification.validate_feature_schemas(
699690
valid_feature_schemas[self.schemaId]['classifications'])

tests/integration/bulk_import/test_ndjson_validation.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,6 @@ def no_tool(text_inference, configured_project):
5151
_validate_ndjson([pred], configured_project)
5252

5353

54-
def test_invalid_datarow_id(text_inference, configured_project):
55-
pred = text_inference.copy()
56-
pred['dataRow']['id'] = "1232132131232"
57-
with pytest.raises(MALValidationError):
58-
_validate_ndjson([pred], configured_project)
59-
60-
6154
def test_invalid_text(text_inference, configured_project):
6255
#and if it is not a string
6356
pred = text_inference.copy()

0 commit comments

Comments
 (0)