Skip to content

Commit

Permalink
formating
Browse files Browse the repository at this point in the history
  • Loading branch information
sosiristseng committed Jun 27, 2024
1 parent 01c39df commit 32bf112
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions run.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,8 @@ function list_notebooks(basedir, cachedir)
shaval = read(nb, String) |> sha256 |> bytes2hex
@info "Notebook $(nb): hash=$(shaval)"
shafilename = joinpath(cachedir, root, splitext(file)[1] * ".sha")
# Cache hit
if isfile(shafilename) && read(shafilename, String) == shaval
@info "Notebook $(nb) cache hits and will not be executed."
# Cache miss
else
@info "Notebook $(nb) cache misses. Writing hash to $(shafilename)."
mkpath(dirname(shafilename))
Expand All @@ -77,7 +75,7 @@ function list_notebooks(basedir, cachedir)
end
end
end
return (;ipynbs, litnbs)
return (; ipynbs, litnbs)
end

@everywhere function run_literate(file, cachedir; rmsvg=true)
Expand All @@ -90,14 +88,13 @@ end

function main(;
basedir=get(ENV, "DOCDIR", "docs"),
cachedir=get(ENV, "NBCACHE", ".cache"), printtable=true,
rmsvg=true
)
cachedir=get(ENV, "NBCACHE", ".cache"),
printtable=true, rmsvg=true)

mkpath(cachedir)
clean_cache(cachedir)

(;ipynbs, litnbs) = list_notebooks(basedir, cachedir)
(; ipynbs, litnbs) = list_notebooks(basedir, cachedir)

# Execute literate notebooks in worker process(es)
ts_lit = pmap(litnbs; on_error=ex -> NaN) do nb
Expand Down

0 comments on commit 32bf112

Please sign in to comment.