Skip to content
Snippets Groups Projects
Commit 768c00bb authored by Pierre-Yves David's avatar Pierre-Yves David :octopus:
Browse files

loop: add an action to upload result

parent 55e9bbc4
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python3
import hashlib
import json
import os
......@@ -4,5 +5,4 @@
import os
from pathlib import Path
import shutil
import subprocess
import sys
......@@ -6,6 +6,11 @@
import shutil
import subprocess
import sys
import tempfile
from pathlib import Path
import poulpe_process_result as resultlib
ACTION_FILE = "current.poulpe-schedule"
......@@ -48,6 +53,8 @@
action_run(base_dir, *args.split())
elif cmd == "AUTOFILL":
action_autofill(base_dir, *[int(x) for x in args.split()])
elif cmd == "UPLOAD":
action_upload(base_dir)
else:
print("unknown action %s" % action, file=sys.stderr)
......@@ -146,6 +153,17 @@
_write_all_actions(base_dir, actions)
def action_upload(base_dir):
results = resultlib.load_results_from_dir(base_dir / "results")
print("upload: gather and upload %d results" % len(results))
dispatched = resultlib.group_results(results)
with tempfile.NamedTemporaryFile(mode="w") as j:
json.dump(dispatched, j)
cmd = [base_dir / "bin" / "upload", j.name]
subprocess.check_call(cmd)
def loop(base_dir="."):
base_dir = Path(base_dir).resolve()
_loop(base_dir)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment