Skip to content

Commit 76a5665

Browse files
author
Gareth
authored
Merge pull request #499 from Labelbox/gj/remove-batches-beta-sdk
Remove beta batch selection
2 parents 526fb82 + 976f644 commit 76a5665

File tree

2 files changed

+0
-88
lines changed

2 files changed

+0
-88
lines changed

labelbox/schema/project.py

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import json
33
import logging
44
import time
5-
import warnings
65
from collections import namedtuple
76
from datetime import datetime, timezone
87
from pathlib import Path
@@ -37,20 +36,12 @@
3736

3837
logger = logging.getLogger(__name__)
3938

40-
MAX_QUEUE_BATCH_SIZE = 1000
41-
4239

4340
class QueueMode(enum.Enum):
4441
Batch = "Batch"
4542
Dataset = "Dataset"
4643

4744

48-
class QueueErrors(enum.Enum):
49-
InvalidDataRowType = 'InvalidDataRowType'
50-
AlreadyInProject = 'AlreadyInProject'
51-
HasAttachedLabel = 'HasAttachedLabel'
52-
53-
5445
class Project(DbObject, Updateable, Deletable):
5546
""" A Project is a container that includes a labeling frontend, an ontology,
5647
datasets and labels.
@@ -578,55 +569,6 @@ def setup(self, labeling_frontend, labeling_frontend_options) -> None:
578569
timestamp = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
579570
self.update(setup_complete=timestamp)
580571

581-
def queue(self, data_row_ids: List[str]):
582-
"""Add Data Rows to the Project queue"""
583-
584-
method = "submitBatchOfDataRows"
585-
return self._post_batch(method, data_row_ids)
586-
587-
def dequeue(self, data_row_ids: List[str]):
588-
"""Remove Data Rows from the Project queue"""
589-
590-
method = "removeBatchOfDataRows"
591-
return self._post_batch(method, data_row_ids)
592-
593-
def _post_batch(self, method, data_row_ids: List[str]):
594-
"""Post batch methods"""
595-
596-
if self.queue_mode() != QueueMode.Batch:
597-
raise ValueError("Project must be in batch mode")
598-
599-
if len(data_row_ids) > MAX_QUEUE_BATCH_SIZE:
600-
raise ValueError(
601-
f"Batch exceeds max size of {MAX_QUEUE_BATCH_SIZE}, consider breaking it into parts"
602-
)
603-
604-
query = """mutation %sPyApi($projectId: ID!, $dataRowIds: [ID!]!) {
605-
project(where: {id: $projectId}) {
606-
%s(data: {dataRowIds: $dataRowIds}) {
607-
dataRows {
608-
dataRowId
609-
error
610-
}
611-
}
612-
}
613-
}
614-
""" % (method, method)
615-
616-
res = self.client.execute(query, {
617-
"projectId": self.uid,
618-
"dataRowIds": data_row_ids
619-
})["project"][method]["dataRows"]
620-
621-
# TODO: figure out error messaging
622-
if len(data_row_ids) == len(res):
623-
raise ValueError("No dataRows were submitted successfully")
624-
625-
if len(data_row_ids) > 0:
626-
warnings.warn("Some Data Rows were not submitted successfully")
627-
628-
return res
629-
630572
def _update_queue_mode(self, mode: QueueMode) -> QueueMode:
631573

632574
if self.queue_mode() == mode:

tests/integration/test_batch.py

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)