21379: Follow rules for federated list queries. 21379-user-activity-remote-collection
authorTom Clegg <tom@curii.com>
Fri, 12 Jan 2024 19:43:43 +0000 (14:43 -0500)
committerTom Clegg <tom@curii.com>
Fri, 12 Jan 2024 19:43:43 +0000 (14:43 -0500)
* cannot execute federated list query unless count=="none"

* cannot execute federated list query with limit (1) < nUUIDs (1),
  offset (0) > 0, or order ([created_at]) parameter

Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

tools/user-activity/arvados_user_activity/main.py

index ded96c3121c0cc8d020b401c4e8b39da791bbdac..66d03b20410e009104e75cb2f1086e2c48adbf59 100755 (executable)
@@ -96,6 +96,7 @@ collectionNameCache = {}
 def getCollectionName(arv, uuid, pdh):
     lookupField = uuid
     filters = [["uuid", "=", uuid]]
+    order = None
     cached = uuid in collectionNameCache
     # look up by uuid if it is available, fall back to look up by pdh
     if uuid is None or len(uuid) != 27:
@@ -105,10 +106,11 @@ def getCollectionName(arv, uuid, pdh):
         # name, if the uuid for the request is not known.
         lookupField = pdh
         filters = [["portable_data_hash", "=", pdh]]
+        order = "created_at"
         cached = pdh in collectionNameCache
 
     if not cached:
-        u = arv.collections().list(filters=filters, order="created_at", limit=1).execute().get("items")
+        u = arv.collections().list(filters=filters, order=order, limit=1, count="none").execute().get("items")
         if len(u) < 1:
             return "(deleted)"
         collectionNameCache[lookupField] = u[0]["name"]