[ARVADOS] created: 2.1.0-2152-gd89f3c32c
Git user
git at public.arvados.org
Wed Mar 23 19:22:00 UTC 2022
at d89f3c32c8c98d7f9a28e796358645683f0f66c9 (commit)
commit d89f3c32c8c98d7f9a28e796358645683f0f66c9
Author: Ward Vandewege <ward at curii.com>
Date: Wed Mar 23 14:08:09 2022 -0400
18903: keep-web: when logging a file upload or download, if the
collection UUID is not known, blank the field rather than
populating it with the PDH (which is also present in a separate
field).
Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward at curii.com>
diff --git a/services/keep-web/handler.go b/services/keep-web/handler.go
index 97ec95e3a..ef61b0687 100644
--- a/services/keep-web/handler.go
+++ b/services/keep-web/handler.go
@@ -913,6 +913,14 @@ func (h *handler) logUploadOrDownload(
WithField("collection_file_path", filepath)
props["collection_uuid"] = collection.UUID
props["collection_file_path"] = filepath
+ // h.determineCollection populates the collection_uuid prop with the PDH, if
+ // this collection is being accessed via PDH. In that case, blank the
+ // collection_uuid field so that consumers of the log entries can rely on it
+ // being a UUID, or blank. The PDH remains available via the
+ // portable_data_hash property.
+ if props["collection_uuid"] == collection.PortableDataHash {
+ props["collection_uuid"] = ""
+ }
}
if r.Method == "PUT" || r.Method == "POST" {
log.Info("File upload")
commit f8819df5b2fb49e42b60a90656fcbe228208388d
Author: Ward Vandewege <ward at curii.com>
Date: Wed Mar 23 13:04:48 2022 -0400
18903: formatting fix for output: always prepend the event timestamp
Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward at curii.com>
diff --git a/tools/user-activity/arvados_user_activity/main.py b/tools/user-activity/arvados_user_activity/main.py
index 15383cd90..2f38db3be 100755
--- a/tools/user-activity/arvados_user_activity/main.py
+++ b/tools/user-activity/arvados_user_activity/main.py
@@ -121,7 +121,7 @@ def main(arguments=None):
elif e["properties"]["new_attributes"]["link_class"] == "permission":
users[owner].append("%s Shared %s with %s" % (event_at, e["properties"]["new_attributes"]["tail_uuid"], e["properties"]["new_attributes"]["head_uuid"]))
else:
- users[owner].append("%s %s %s %s" % (e["event_type"], e["object_kind"], e["object_uuid"], loguuid))
+ users[owner].append("%s %s %s %s %s" % (event_at, e["event_type"], e["object_kind"], e["object_uuid"], loguuid))
elif e["event_type"] == "delete" and e["object_uuid"][6:11] == "o0j2j":
if e["properties"]["old_attributes"]["link_class"] == "tag":
@@ -129,7 +129,7 @@ def main(arguments=None):
elif e["properties"]["old_attributes"]["link_class"] == "permission":
users[owner].append("%s Unshared %s with %s" % (event_at, e["properties"]["old_attributes"]["tail_uuid"], e["properties"]["old_attributes"]["head_uuid"]))
else:
- users[owner].append("%s %s %s %s" % (e["event_type"], e["object_kind"], e["object_uuid"], loguuid))
+ users[owner].append("%s %s %s %s %s" % (event_at, e["event_type"], e["object_kind"], e["object_uuid"], loguuid))
elif e["event_type"] == "create" and e["object_uuid"][6:11] == "4zz18":
if e["properties"]["new_attributes"]["properties"].get("type") in ("log", "output", "intermediate"):
@@ -162,7 +162,7 @@ def main(arguments=None):
e["properties"].get("collection_uuid")))
else:
- users[owner].append("%s %s %s %s" % (e["event_type"], e["object_kind"], e["object_uuid"], loguuid))
+ users[owner].append("%s %s %s %s %s" % (event_at, e["event_type"], e["object_kind"], e["object_uuid"], loguuid))
for k,v in users.items():
if k is None or k.endswith("-tpzed-000000000000000"):
commit 5698689547f38b7a93e7ef6d313a627934124832
Author: Ward Vandewege <ward at curii.com>
Date: Wed Mar 23 12:07:51 2022 -0400
18903: the user activity script needs to look up collections by PDH, not
UUID (that field is not always populated with a UUID).
Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward at curii.com>
diff --git a/tools/user-activity/arvados_user_activity/main.py b/tools/user-activity/arvados_user_activity/main.py
index 841685f01..15383cd90 100755
--- a/tools/user-activity/arvados_user_activity/main.py
+++ b/tools/user-activity/arvados_user_activity/main.py
@@ -42,11 +42,13 @@ def getuserinfo(arv, uuid):
uuid, prof)
collectionNameCache = {}
-def getCollectionName(arv, uuid):
- if uuid not in collectionNameCache:
- u = arv.collections().get(uuid=uuid).execute()
- collectionNameCache[uuid] = u["name"]
- return collectionNameCache[uuid]
+def getCollectionName(arv, pdh):
+ if pdh not in collectionNameCache:
+ u = arv.collections().list(filters=[["portable_data_hash","=",pdh]]).execute().get("items")
+ if len(u) < 1:
+ return "(deleted)"
+ collectionNameCache[pdh] = u[0]["name"]
+ return collectionNameCache[pdh]
def getname(u):
return "\"%s\" (%s)" % (u["name"], u["uuid"])
@@ -148,7 +150,7 @@ def main(arguments=None):
users.setdefault(e["object_uuid"], [])
users[e["object_uuid"]].append("%s Downloaded file \"%s\" from \"%s\" (%s) (%s)" % (event_at,
e["properties"].get("collection_file_path") or e["properties"].get("reqPath"),
- getCollectionName(arv, e["properties"].get("collection_uuid")),
+ getCollectionName(arv, e["properties"].get("portable_data_hash")),
e["properties"].get("collection_uuid"),
e["properties"].get("portable_data_hash")))
@@ -156,7 +158,7 @@ def main(arguments=None):
users.setdefault(e["object_uuid"], [])
users[e["object_uuid"]].append("%s Uploaded file \"%s\" to \"%s\" (%s)" % (event_at,
e["properties"].get("collection_file_path") or e["properties"].get("reqPath"),
- getCollectionName(arv, e["properties"].get("collection_uuid")),
+ getCollectionName(arv, e["properties"].get("portable_data_hash")),
e["properties"].get("collection_uuid")))
else:
commit dffe2b5c67da2086bde865a0005b6b908b074e0c
Author: Ward Vandewege <ward at curii.com>
Date: Wed Mar 23 11:00:08 2022 -0400
18903: fix uninitialized user object in the user activity script.
Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward at curii.com>
diff --git a/tools/user-activity/arvados_user_activity/main.py b/tools/user-activity/arvados_user_activity/main.py
index 997da57e0..841685f01 100755
--- a/tools/user-activity/arvados_user_activity/main.py
+++ b/tools/user-activity/arvados_user_activity/main.py
@@ -145,6 +145,7 @@ def main(arguments=None):
users[owner].append("%s Deleted collection %s %s" % (event_at, getname(e["properties"]["old_attributes"]), loguuid))
elif e["event_type"] == "file_download":
+ users.setdefault(e["object_uuid"], [])
users[e["object_uuid"]].append("%s Downloaded file \"%s\" from \"%s\" (%s) (%s)" % (event_at,
e["properties"].get("collection_file_path") or e["properties"].get("reqPath"),
getCollectionName(arv, e["properties"].get("collection_uuid")),
@@ -152,6 +153,7 @@ def main(arguments=None):
e["properties"].get("portable_data_hash")))
elif e["event_type"] == "file_upload":
+ users.setdefault(e["object_uuid"], [])
users[e["object_uuid"]].append("%s Uploaded file \"%s\" to \"%s\" (%s)" % (event_at,
e["properties"].get("collection_file_path") or e["properties"].get("reqPath"),
getCollectionName(arv, e["properties"].get("collection_uuid")),
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list