aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Amstutz2020-07-16 14:28:02 -0400
committerPeter Amstutz2020-07-16 14:28:02 -0400
commit474d15e17be63046a091615e89ba63adecdb109b (patch)
tree94a95820fcca8d8f5f0b2b3cfc9b1774f79e408b
parent15624e038e0f368d2be4c9a76ace77da4d673fdd (diff)
downloadbh20-seq-resource-474d15e17be63046a091615e89ba63adecdb109b.tar.gz
bh20-seq-resource-474d15e17be63046a091615e89ba63adecdb109b.tar.lz
bh20-seq-resource-474d15e17be63046a091615e89ba63adecdb109b.zip
Cleanup script also clears errors for revalidate
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz@curii.com>
-rw-r--r--scripts/cleanup.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/scripts/cleanup.py b/scripts/cleanup.py
index f4bd0b4..6a82659 100644
--- a/scripts/cleanup.py
+++ b/scripts/cleanup.py
@@ -3,18 +3,36 @@ import arvados.util
api = arvados.api()
-patterns = [
+delete_patterns = [
"%missing%`collection_location`%",
"%missing%`technology`%",
"%missing%`host_species`%",
"%QC fail: alignment%",
"%does not look like a valid URI%",
+ "%Duplicate of%"
]
-for p in patterns:
+revalidate_patterns = [
+ "%missing%`license`%"
+]
+
+for p in delete_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()
+
+for p in revalidate_patterns:
+ c = arvados.util.list_all(api.collections().list, filters=[
+ ["owner_uuid", "=", "lugli-j7d0g-n5clictpuvwk8aa"],
+ ["properties.errors", "like", p]])
+ for i in c:
+ print("clearing status %s %s" % (i["uuid"], i["properties"].get("sequence_label")))
+ pr = i["properties"]
+ if "status" in pr:
+ del pr["status"]
+ if "errors" in pr:
+ del pr["errors"]
+ api.collections().update(uuid=i["uuid"], body={"properties": pr}).execute()