Skip to content

Commit d95b26b

Browse files
Add a script for removing the queued docking tasks (#163)
1 parent 1e16bb6 commit d95b26b

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import os
2+
import json
3+
4+
def main():
5+
"""
6+
This script is used to fix the status of the docking tasks that are in the "queued" status.
7+
It will change the status to "failed" and set the hash to "undefined" (to allow the task to be re-queued).
8+
9+
Run this script in the root directory of the tasks (e.g. /data/prankweb/docking).
10+
"""
11+
for root, dirs, files in os.walk("."):
12+
for file in files:
13+
if file == "info.json":
14+
try:
15+
with open(os.path.join(root, file), "r") as f:
16+
changed = False
17+
content = json.load(f)
18+
if "tasks" in content:
19+
for task in content["tasks"]:
20+
if task["status"] == "queued":
21+
task["initialData"]["hash"] = "undefined"
22+
task["status"] = "failed"
23+
changed = True
24+
25+
if changed:
26+
print("Changing file: ", os.path.join(root, file))
27+
with open(os.path.join(root, file), "w") as f:
28+
json.dump(content, f)
29+
30+
except Exception as e:
31+
print(f"Error in file {os.path.join(root, file)}: {e}")
32+
33+
if __name__ == "__main__":
34+
main()

0 commit comments

Comments
 (0)