Batch

class labelbox.schema.batch.Batch(client, project_id, *args, failed_data_row_ids=[], **kwargs)[source]

Bases: DbObject

A Batch is a group of data rows submitted to a project for labeling

name
Type:

str

created_at
Type:

datetime

updated_at
Type:

datetime

deleted
Type:

bool

project[source]

ToOne relationship to Project

Type:

Relationship

created_by

ToOne relationship to User

Type:

Relationship

delete() None[source]

Deletes the given batch.

Note: Batch deletion for batches that has labels is forbidden.

Parameters:

batch (Batch) – Batch to remove queued data rows from

delete_labels(set_labels_as_template=False) None[source]

Deletes labels that were created for data rows in the batch.

Parameters:
  • batch (Batch) – Batch to remove queued data rows from

  • set_labels_as_template (bool) – When set to true, the deleted labels will be kept as templates.

export_data_rows(timeout_seconds=120, include_metadata: bool = False) Generator[source]

Returns a generator that produces all data rows that are currently in this batch.

Note: For efficiency, the data are cached for 30 minutes. Newly created data rows will not appear until the end of the cache period.

Parameters:
  • timeout_seconds (float) – Max waiting time, in seconds.

  • include_metadata (bool) – True to return related DataRow metadata

Returns:

Generator that yields DataRow objects belonging to this batch.

Raises:

LabelboxError – if the export fails or is unable to download within the specified time.

project() Project[source]

Returns Project which this Batch belongs to

Raises:

LabelboxError – if the project is not found

remove_queued_data_rows() None[source]

Removes remaining queued data rows from the batch and labeling queue.

Parameters:

batch (Batch) – Batch to remove queued data rows from