Skip to content

Commit

Permalink
Read artefact paths from a file
Browse files Browse the repository at this point in the history
Instead of hardcoding them into the worker
  • Loading branch information
xrchz committed Dec 4, 2017
1 parent 505499e commit 0d7ccf6
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions worker.sml
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,7 @@ val CAKEMLDIR_git = "cakeml.git"
fun mk_HOLDIR sha = String.concat["HOL-",sha]
fun mk_CAKEMLDIR jid = String.concat["cakeml-",jid]

val artefact_paths = [
"compiler/bootstrap/compilation/x64/cake-x64.tar.gz",
"compiler/bootstrap/compilation/riscv/cake-riscv.tar.gz" ]
val artefacts_file = OS.Path.concat("developers","artefacts")

val git_path = "/usr/bin/git"
fun git_reset sha = (git_path,["reset","--hard","--quiet",sha])
Expand Down Expand Up @@ -259,6 +257,19 @@ fun upload CAKEMLDIR id f =
else warn ["Could not find ",p," to upload."]
end

fun upload_artefacts CAKEMLDIR id =
let
val f = OS.Path.concat(CAKEMLDIR,artefacts_file)
in
let
val inp = TextIO.openIn f
fun loop () =
case TextIO.inputLine inp of NONE => TextIO.closeIn inp
| SOME line => (upload CAKEMLDIR id (trimr line); loop ())
in loop () end
handle e as OS.SysErr _ => warn ["Could not find artefacts list ",f,"\n",exnMessage e]
end

local
val resume_file = "resume"
val time_options = String.concat["--format='%e %M' --output='",timing_file,"'"]
Expand Down Expand Up @@ -320,7 +331,7 @@ in
if success then
let in
API.post (Append(id,"SUCCESS"));
if is_master then List.app (upload CAKEMLDIR id) artefact_paths else ();
if is_master then upload_artefacts CAKEMLDIR id else ();
API.post (Stop id)
end
else ()
Expand Down Expand Up @@ -429,7 +440,7 @@ fun main () =
val () = case get_int_arg "--upload" args of NONE => ()
| SOME id => let val jid = Int.toString id in
diag ["Uploading artefacts for job ",jid,"."];
List.app (upload (mk_CAKEMLDIR jid) id) artefact_paths;
upload_artefacts (mk_CAKEMLDIR jid) id;
OS.Process.exit OS.Process.success
end
val no_wait = List.exists (equal"--no-wait") args
Expand Down

0 comments on commit 0d7ccf6

Please sign in to comment.