File tree Expand file tree Collapse file tree 1 file changed +8
-17
lines changed
Expand file tree Collapse file tree 1 file changed +8
-17
lines changed Original file line number Diff line number Diff line change @@ -186,15 +186,11 @@ def find_task_id_batched(index_paths):
186186 https://docs.taskcluster.net/docs/reference/core/index/api#findTasksAtIndex
187187 """
188188 index = get_taskcluster_client ("index" )
189- response = index .findTasksAtIndex ({"indexes" : index_paths })
189+ task_ids = {}
190+ def pagination_handler (response ):
191+ task_ids .update ({["namespace" ]: t ["taskId" ] for t in response ["tasks" ] if "namespace" in t and "taskId" in t })
190192
191- if not response or "tasks" not in response :
192- return {}
193-
194- tasks = response .get ("tasks" , [])
195- task_ids = {
196- t ["namespace" ]: t ["taskId" ] for t in tasks if "namespace" in t and "taskId" in t
197- }
193+ index .findTasksAtIndex (payload = {"indexes" : index_paths }, paginationHandler = pagination_handler )
198194
199195 return task_ids
200196
@@ -296,17 +292,12 @@ def status_task_batched(task_ids):
296292 return {}
297293
298294 queue = get_taskcluster_client ("queue" )
299- response = queue .statuses ({"taskIds" : task_ids })
295+ statuses = {}
296+ def pagination_handler (response ):
297+ statuses .update ({t ["taskId" ]: t ["status" ] for t in response .get ("statuses" , []) if "namespace" in t and "taskId" in t })
300298
301- if not response or "statuses" not in response :
302- return {}
299+ queue .statuses (payload = {"taskIds" : task_ids }, paginationHandler = pagination_handler )
303300
304- status_list = response .get ("statuses" , [])
305- statuses = {
306- t ["taskId" ]: t ["status" ]
307- for t in status_list
308- if "namespace" in t and "taskId" in t
309- }
310301 return statuses
311302
312303
You can’t perform that action at this time.
0 commit comments