Skip to content

Commit 43af8fa

Browse files
author
gdj0nes
committed
CHG: remove old batch selection sdk methods
1 parent fc14620 commit 43af8fa

File tree

1 file changed

+1
-59
lines changed

1 file changed

+1
-59
lines changed

labelbox/schema/project.py

Lines changed: 1 addition & 59 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.
@@ -570,55 +561,6 @@ def setup(self, labeling_frontend, labeling_frontend_options) -> None:
570561
timestamp = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
571562
self.update(setup_complete=timestamp)
572563

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

624566
if self.queue_mode() == mode:
@@ -935,7 +877,7 @@ class LabelingParameterOverride(DbObject):
935877

936878
LabelerPerformance = namedtuple(
937879
"LabelerPerformance", "user count seconds_per_label, total_time_labeling "
938-
"consensus average_benchmark_agreement last_activity_time")
880+
"consensus average_benchmark_agreement last_activity_time")
939881
LabelerPerformance.__doc__ = (
940882
"Named tuple containing info about a labeler's performance.")
941883

0 commit comments

Comments
 (0)