flash board and send output to hydra log

pull/16/head
Sebastien Bourdeauducq 2019-02-19 00:24:08 +08:00
parent e16c81e8da
commit 3ce85ccc11
1 changed files with 8 additions and 6 deletions

View File

@ -1,14 +1,16 @@
import json import json
import bz2
import sys import sys
import subprocess
with open(sys.argv[1], "r") as f: with open(sys.argv[1], "r") as hydra_json_file:
hydra_json = json.load(f) hydra_json = json.load(hydra_json_file)
drv = hydra_json["drvPath"] drv = hydra_json["drvPath"]
assert drv.startswith("/nix/store/") assert drv.startswith("/nix/store/")
drv = drv[len("/nix/store/"):] drv = drv[len("/nix/store/"):]
hydra_log = "/var/lib/hydra/build-logs/" + drv[:2] + "/" + drv[2:] + ".bz2" hydra_log = "/var/lib/hydra/build-logs/" + drv[:2] + "/" + drv[2:]
with bz2.BZ2File(hydra_log, "w") as f: with open(hydra_log, "w") as log:
f.write(b"hack successful") def run(*args):
subprocess.run(args, stdout=log, stderr=log).check_returncode()
run("artiq_flash", "-t", "kc705", "-V", "nist_clock")