@@ -119,12 +119,12 @@ class BulkImportRequest(DbObject):
119
119
def inputs (self ) -> List [Dict [str , Any ]]:
120
120
"""
121
121
Inputs for each individual annotation uploaded.
122
- This should match the ndjson annotations that you have uploaded.
123
-
122
+ This should match the ndjson annotations that you have uploaded.
123
+
124
124
Returns:
125
125
Uploaded ndjson.
126
126
127
- * This information will expire after 24 hours.
127
+ * This information will expire after 24 hours.
128
128
"""
129
129
return self ._fetch_remote_ndjson (self .input_file_url )
130
130
@@ -137,7 +137,7 @@ def errors(self) -> List[Dict[str, Any]]:
137
137
List of dicts containing error messages. Empty list means there were no errors
138
138
See `BulkImportRequest.statuses` for more details.
139
139
140
- * This information will expire after 24 hours.
140
+ * This information will expire after 24 hours.
141
141
"""
142
142
self .wait_until_done ()
143
143
return self ._fetch_remote_ndjson (self .error_file_url )
@@ -150,14 +150,14 @@ def statuses(self) -> List[Dict[str, Any]]:
150
150
Returns:
151
151
A status for each annotation if the upload is done running.
152
152
See below table for more details
153
-
153
+
154
154
.. list-table::
155
155
:widths: 15 150
156
- :header-rows: 1
156
+ :header-rows: 1
157
157
158
158
* - Field
159
159
- Description
160
- * - uuid
160
+ * - uuid
161
161
- Specifies the annotation for the status row.
162
162
* - dataRow
163
163
- JSON object containing the Labelbox data row ID for the annotation.
@@ -166,7 +166,7 @@ def statuses(self) -> List[Dict[str, Any]]:
166
166
* - errors
167
167
- An array of error messages included when status is FAILURE. Each error has a name, message and optional (key might not exist) additional_info.
168
168
169
- * This information will expire after 24 hours.
169
+ * This information will expire after 24 hours.
170
170
"""
171
171
self .wait_until_done ()
172
172
return self ._fetch_remote_ndjson (self .status_file_url )
@@ -390,27 +390,26 @@ def create_from_local_file(cls,
390
390
391
391
def _validate_ndjson (lines : Iterable [Dict [str , Any ]],
392
392
project : "labelbox.Project" ) -> None :
393
- """
393
+ """
394
394
Client side validation of an ndjson object.
395
395
396
396
Does not guarentee that an upload will succeed for the following reasons:
397
397
* We are not checking the data row types which will cause the following errors to slip through
398
398
* Missing frame indices will not causes an error for videos
399
- * Uploaded annotations for the wrong data type will pass (Eg. entity on images)
399
+ * Uploaded annotations for the wrong data type will pass (Eg. entity on images)
400
400
* We are not checking bounds of an asset (Eg. frame index, image height, text location)
401
-
401
+
402
402
Args:
403
403
lines (Iterable[Dict[str,Any]]): An iterable of ndjson lines
404
404
project (Project): id of project for which predictions will be imported
405
-
405
+
406
406
Raises:
407
407
MALValidationError: Raise for invalid NDJson
408
408
UuidError: Duplicate UUID in upload
409
409
"""
410
- data_row_ids = {
411
- data_row .uid : data_row for dataset in project .datasets ()
412
- for data_row in dataset .data_rows ()
413
- }
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 }
414
413
feature_schemas = get_mal_schemas (project .ontology ())
415
414
uids : Set [str ] = set ()
416
415
for idx , line in enumerate (lines ):
@@ -539,7 +538,7 @@ def build(cls: Any, data: Union[dict, BaseModel]) -> "NDBase":
539
538
raises:
540
539
KeyError: data does not contain the determinant fields for any of the types supported by this SpecialUnion
541
540
ValidationError: Error while trying to construct a specific object in the union
542
-
541
+
543
542
"""
544
543
if isinstance (data , BaseModel ):
545
544
data = data .dict ()
0 commit comments