aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorPeter Amstutz2020-07-16 12:32:43 -0400
committerPeter Amstutz2020-07-16 12:33:07 -0400
commit6bfefe984a84fb215d61e045c49a4ab123bb7339 (patch)
tree86609a1d6b57dfac7ccbeb3ef3bcf6b36f677853 /scripts
parent0e84b18cb134855d572d1f94d5d3c43571afe7e9 (diff)
downloadbh20-seq-resource-6bfefe984a84fb215d61e045c49a4ab123bb7339.tar.gz
bh20-seq-resource-6bfefe984a84fb215d61e045c49a4ab123bb7339.tar.lz
bh20-seq-resource-6bfefe984a84fb215d61e045c49a4ab123bb7339.zip
Catch exceptions
Add script to cleanup bad uploads. Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz@curii.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/cleanup.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/scripts/cleanup.py b/scripts/cleanup.py
new file mode 100644
index 0000000..f4bd0b4
--- /dev/null
+++ b/scripts/cleanup.py
@@ -0,0 +1,20 @@
+import arvados
+import arvados.util
+
+api = arvados.api()
+
+patterns = [
+ "%missing%`collection_location`%",
+ "%missing%`technology`%",
+ "%missing%`host_species`%",
+ "%QC fail: alignment%",
+ "%does not look like a valid URI%",
+ ]
+
+for p in patterns:
+ c = arvados.util.list_all(api.collections().list, filters=[
+ ["owner_uuid", "=", "lugli-j7d0g-n5clictpuvwk8aa"],
+ ["properties.errors", "like", p]])
+ for i in c:
+ print("trashing %s %s" % (i["uuid"], i["properties"].get("sequence_label")))
+ api.collections().delete(uuid=i["uuid"]).execute()