Bulk Import Request

class labelbox.schema.bulk_import_request.BulkImportRequest(client, field_values)[source]

Bases: DbObject

Represents the import job when importing annotations.

name
Type:

str

state

FAILED, RUNNING, or FINISHED (Refers to the whole import job)

Type:

Enum

input_file_url

URL to your web-hosted NDJSON file

Type:

str

error_file_url

NDJSON that contains error messages for failed annotations

Type:

str

status_file_url

NDJSON that contains status for each annotation

Type:

str

created_at

UTC timestamp for date BulkImportRequest was created

Type:

datetime

project

ToOne relationship to Project

Type:

Relationship

created_by

ToOne relationship to User

Type:

Relationship

delete() None[source]

Deletes the import job and also any annotations created by this import.

Returns:

None

property errors: List[Dict[str, Any]]

Errors for each individual annotation uploaded. This is a subset of statuses

Returns:

List of dicts containing error messages. Empty list means there were no errors See BulkImportRequest.statuses for more details.

  • This information will expire after 24 hours.

property inputs: List[Dict[str, Any]]

Inputs for each individual annotation uploaded. This should match the ndjson annotations that you have uploaded.

Returns:

Uploaded ndjson.

  • This information will expire after 24 hours.

refresh() None[source]

Synchronizes values of all fields with the database.

property statuses: List[Dict[str, Any]]

Status for each individual annotation uploaded.

Returns:

A status for each annotation if the upload is done running. See below table for more details

Field

Description

uuid

Specifies the annotation for the status row.

dataRow

JSON object containing the Labelbox data row ID for the annotation.

status

Indicates SUCCESS or FAILURE.

errors

An array of error messages included when status is FAILURE. Each error has a name, message and optional (key might not exist) additional_info.

  • This information will expire after 24 hours.

wait_until_done(sleep_time_seconds: int = 5) None[source]

Blocks import job until certain conditions are met.

Blocks until the BulkImportRequest.state changes either to BulkImportRequestState.FINISHED or BulkImportRequestState.FAILED, periodically refreshing object’s state.

Parameters:

sleep_time_seconds (str) – a time to block between subsequent API calls

labelbox.schema.bulk_import_request.get_mal_schemas(ontology)[source]

Converts a project ontology to a dict for easier lookup during ndjson validation

Parameters:

ontology (Ontology) –

Returns:

Useful for looking up a tool from a given feature schema id or name

Return type:

Dict, Dict

labelbox.schema.bulk_import_request.parse_classification(tool)[source]

Parses a classification from an ontology. Only radio, checklist, and text are supported for mal

Parameters:

tool (dict) –

Returns:

dict