-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f9e2768
commit 06bdfd3
Showing
8 changed files
with
408 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,3 +30,6 @@ xla-*.tar | |
|
||
# Output from compilations within Docker | ||
/builds/output/ | ||
|
||
# Archive checksums file | ||
/checksum.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
defmodule Mix.Tasks.Xla.Checksum do | ||
@moduledoc """ | ||
Generates a checksum file for all precompiled artifacts. | ||
""" | ||
|
||
use Mix.Task | ||
|
||
@impl true | ||
def run(_args) do | ||
XLA.Utils.start_inets_profile() | ||
|
||
Mix.shell().info("Downloading and computing checksums...") | ||
|
||
checksums = | ||
XLA.precompiled_files() | ||
|> Task.async_stream( | ||
fn {filename, url} -> | ||
{filename, download_checksum!(url)} | ||
end, | ||
timeout: :infinity, | ||
ordered: false | ||
) | ||
|> Map.new(fn {:ok, {filename, checksum}} -> {filename, checksum} end) | ||
|
||
XLA.write_checksums!(checksums) | ||
|
||
Mix.shell().info("Checksums written") | ||
after | ||
XLA.Utils.stop_inets_profile() | ||
end | ||
|
||
defp download_checksum!(url) do | ||
case XLA.Utils.download(url, %XLA.Checksumer{}) do | ||
{:ok, checksum} -> | ||
checksum | ||
|
||
{:error, message} -> | ||
Mix.raise("failed to download archive from #{url}, reason: #{message}") | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.