55from collections import namedtuple
66from datetime import datetime , timezone
77from pathlib import Path
8- from typing import TYPE_CHECKING , Any , Dict , Iterable , List , Optional , Union
8+ from typing import TYPE_CHECKING , Any , Dict , Iterable , List , Optional , TypeVar , Union , overload
99from urllib .parse import urlparse
1010
1111import requests
1212
1313from labelbox import parser
1414from labelbox import utils
15- from labelbox .exceptions import (InvalidQueryError , LabelboxError ,
16- ProcessingWaitTimeout , ResourceConflict ,
17- ResourceNotFoundError )
15+ from labelbox .exceptions import (
16+ InvalidQueryError ,
17+ LabelboxError ,
18+ ProcessingWaitTimeout ,
19+ ResourceConflict ,
20+ )
1821from labelbox .orm import query
1922from labelbox .orm .db_object import DbObject , Deletable , Updateable , experimental
2023from labelbox .orm .model import Entity , Field , Relationship
2528from labelbox .schema .export_filters import ProjectExportFilters , validate_datetime , build_filters
2629from labelbox .schema .export_params import ProjectExportParams
2730from labelbox .schema .export_task import ExportTask
28- from labelbox .schema .identifiable import DataRowIdentifiers , IdType , UniqueIds , strings_to_identifiable
31+ from labelbox .schema .identifiable import DataRowIdentifiers , strings_to_identifiable
2932from labelbox .schema .media_type import MediaType
3033from labelbox .schema .queue_mode import QueueMode
3134from labelbox .schema .resource_tag import ResourceTag
@@ -1375,29 +1378,43 @@ def task_queues(self) -> List[TaskQueue]:
13751378 for field_values in task_queue_values
13761379 ]
13771380
1381+ @overload
1382+ def move_data_rows_to_task_queue (self , data_row_ids : DataRowIdentifiers ,
1383+ task_queue_id : str ):
1384+ pass
1385+
1386+ @overload
13781387 def move_data_rows_to_task_queue (self , data_row_ids : List [str ],
13791388 task_queue_id : str ):
1389+ pass
1390+
1391+ def move_data_rows_to_task_queue (self , data_row_ids , task_queue_id : str ):
13801392 """
13811393
13821394 Moves data rows to the specified task queue.
13831395
13841396 Args:
1385- data_row_ids: a list of data row ids to be moved
1397+ data_row_ids: a list of data row ids to be moved. This can be a list of strings or a DataRowIdentifiers object
1398+ DataRowIdentifier objects are lists of ids or global keys
13861399 task_queue_id: the task queue id to be moved to, or None to specify the "Done" queue
13871400
13881401 Returns:
13891402 None if successful, or a raised error on failure
13901403
13911404 """
1405+ if isinstance (data_row_ids , list ):
1406+ data_row_ids = strings_to_identifiable (data_row_ids )
1407+
13921408 method = "createBulkAddRowsToQueueTask"
13931409 query_str = """mutation AddDataRowsToTaskQueueAsyncPyApi(
13941410 $projectId: ID!
13951411 $queueId: ID
13961412 $dataRowIds: [ID!]!
1413+ $idType: IdType!
13971414 ) {
13981415 project(where: { id: $projectId }) {
13991416 %s(
1400- data: { queueId: $queueId, dataRowIds: $dataRowIds }
1417+ data: { queueId: $queueId, dataRowIds: $dataRowIds, idType: $idType }
14011418 ) {
14021419 taskId
14031420 }
@@ -1409,7 +1426,8 @@ def move_data_rows_to_task_queue(self, data_row_ids: List[str],
14091426 query_str , {
14101427 "projectId" : self .uid ,
14111428 "queueId" : task_queue_id ,
1412- "dataRowIds" : data_row_ids
1429+ "dataRowIds" : data_row_ids .keys ,
1430+ "idType" : data_row_ids .id_type ,
14131431 },
14141432 timeout = 180.0 ,
14151433 experimental = True )["project" ][method ]["taskId" ]
0 commit comments