[ARVADOS] updated: 1.3.0-832-g163acd673

Git user git at public.curoverse.com
Wed May 1 20:36:22 UTC 2019


Summary of changes:
 tools/rerun/keep-rerun.py | 59 +++++++++++++++++++++++++++--------------------
 1 file changed, 34 insertions(+), 25 deletions(-)

       via  163acd6733a4af2969875ef72ad8c3b225a11e02 (commit)
      from  889cdaf5db96d87f14cff6a232408ab55e1226b6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 163acd6733a4af2969875ef72ad8c3b225a11e02
Author: Peter Amstutz <pamstutz at veritasgenetics.com>
Date:   Wed May 1 16:30:31 2019 -0400

    15112: Don't submit anything, just produce a csv file with results
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>

diff --git a/tools/rerun/keep-rerun.py b/tools/rerun/keep-rerun.py
index 58372064e..a497dc8c3 100755
--- a/tools/rerun/keep-rerun.py
+++ b/tools/rerun/keep-rerun.py
@@ -1,8 +1,16 @@
 #!/usr/bin/env python
+#
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+#
+
 from __future__ import print_function, absolute_import
 import argparse
 import arvados
 import arvados.util
+import csv
+import sys
 
 """
 Given a list of collections missing blocks (as produced by
@@ -15,12 +23,18 @@ def rerun_request(arv, container_requests_to_rerun, ct):
         if cr["requesting_container_uuid"]:
             rerun_request(arv, container_requests_to_rerun, arv.containers().get(uuid=cr["requesting_container_uuid"]).execute())
         else:
-            container_requests_to_rerun.append(cr)
+            container_requests_to_rerun[cr["uuid"]] = cr
 
+def get_owner(arv, owners, uuid):
+    if uuid not in owners:
+        if uuid[6:11] == "tpzed":
+            owners[uuid] = arv.users().get(uuid=uuid).execute()["full_name"]
+        else:
+            owners[uuid] = arv.groups().get(uuid=uuid).execute()["name"]
+    return owners[uuid]
 
 def main():
     parser = argparse.ArgumentParser(description='Re-run containers associated with missing blocks')
-    parser.add_argument('--dry-run', action='store_true', default=False)
     parser.add_argument('inp')
     args = parser.parse_args()
 
@@ -36,38 +50,33 @@ def main():
         for c in collections:
             busted_collections.add(c)
 
+    out = csv.writer(sys.stdout)
+
+    out.writerow(("collection uuid", "container request uuid", "record name", "modified at", "owner uuid", "owner name", "notes"))
+
+    owners = {}
     collections_to_delete = {}
-    container_requests_to_rerun = []
+    container_requests_to_rerun = {}
     # Get containers that produced these collections
+    i = 0
     for b in busted_collections:
+        i += 1
         collections_to_delete = arvados.util.list_all(arv.collections().list, filters=[["portable_data_hash", "=", b]])
         for d in collections_to_delete:
-            print("Will delete %s" % d["uuid"])
-            if not args.dry_run:
-                arv.collections().delete(uuid=d["uuid"]).execute()
+            t = ""
+            if d["properties"].get("type") not in ("output", "log"):
+                t = "\"type\" was '%s', expected one of 'output' or 'log'" % d["properties"].get("type")
+            out.writerow((d["uuid"], "", d["name"], d["modified_at"], d["owner_uuid"], get_owner(arv, owners, d["owner_uuid"]), t))
+
         maybe_containers_to_rerun = arvados.util.list_all(arv.containers().list, filters=[["output", "=", b]])
         for ct in maybe_containers_to_rerun:
             rerun_request(arv, container_requests_to_rerun, ct)
 
-    for cr in container_requests_to_rerun:
-        new_cr = {}
-        for f in ("command",
-                  "cwd",
-                  "environment",
-                  "output_path",
-                  "container_image",
-                  "mounts",
-                  "runtime_constraints",
-                  "scheduling_parameters",
-                  "owner_uuid"):
-            new_cr[f] = cr[f]
-        new_cr["name"] = cr["name"] + " rerun"
-        new_cr["state"] = "Committed"
-        new_cr["priority"] = 500
-        print("Will re-run %s" % cr["uuid"])
-        if not args.dry_run:
-            new_cr = arv.container_requests().create(body=new_cr).execute()
-            print("Submitted %s" % new_cr["uuid"])
+    i = 0
+    for _, cr in container_requests_to_rerun.items():
+        i += 1
+        out.writerow(("", cr["uuid"], cr["name"], cr["modified_at"], cr["owner_uuid"], get_owner(arv, owners, cr["owner_uuid"]), ""))
+
 
 if __name__ == "__main__":
     main()

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list