Skip to content

Commit

Permalink
Change wording and show bar if status changes to back to empty
Browse files Browse the repository at this point in the history
  • Loading branch information
nhz2 committed Aug 26, 2024
1 parent ebf9a3a commit 342497b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Artifacts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ function download_artifact(
end
end
# Move it to the location we expected
isnothing(progress) || progress(10000, 10000; status="installing")
isnothing(progress) || progress(10000, 10000; status="moving to artifact store")
_mv_temp_artifact_dir(temp_dir, dst)
catch err
@debug "download_artifact error" tree_hash tarball_url tarball_hash err
Expand Down
11 changes: 6 additions & 5 deletions src/Operations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ function download_artifacts(ctx::Context;
dstate.state = :running
ret()
if !fancyprint
@lock print_lock printpkgstyle(io, :Downloaded, "artifact $rname $(MiniProgressBars.pkg_format_bytes(dstate.bar.max; sigdigits=1))")
@lock print_lock printpkgstyle(io, :Installed, "artifact $rname $(MiniProgressBars.pkg_format_bytes(dstate.bar.max; sigdigits=1))")
end
catch
dstate.state = :failed
Expand All @@ -908,7 +908,7 @@ function download_artifacts(ctx::Context;
first = true
timer = Timer(0, interval=1/10)
# TODO: Implement as a new MiniMultiProgressBar
main_bar = MiniProgressBar(; indent=1, header = "Downloading artifacts", color = :green, mode = :int, always_reprint=true)
main_bar = MiniProgressBar(; indent=1, header = "Installing artifacts", color = :green, mode = :int, always_reprint=true)
main_bar.max = length(download_states)
while !is_done
main_bar.current = count(x -> x.state == :done, values(download_states))
Expand All @@ -920,7 +920,8 @@ function download_artifacts(ctx::Context;
for dstate in sort!(collect(values(download_states)), by=v->v.bar.max, rev=true)
local status, status_update_time = lock(()->(dstate.status, dstate.status_update_time), dstate.status_lock)
# only update the bar's status message if it is stalled for at least 0.5 s.
if time_ns() - status_update_time > UInt64(500_000_000)
# If the new status message is empty, go back to showing the bar without waiting.
if isempty(status) || time_ns() - status_update_time > UInt64(500_000_000)
dstate.bar.status = status
end
dstate.state == :running && (dstate.bar.max > 1000 || !isempty(dstate.bar.status)) || continue
Expand All @@ -946,7 +947,7 @@ function download_artifacts(ctx::Context;
end
Base.errormonitor(t_print)
else
printpkgstyle(io, :Downloading, "$(length(download_jobs)) artifacts")
printpkgstyle(io, :Installing, "$(length(download_jobs)) artifacts")
end
sema = Base.Semaphore(ctx.num_concurrent_downloads)
interrupted = false
Expand Down Expand Up @@ -974,7 +975,7 @@ function download_artifacts(ctx::Context;
length(all_errors) > 1 && println(iostr)
end
end
pkgerror("Failed to download some artifacts:\n\n$(strip(str, '\n'))")
pkgerror("Failed to install some artifacts:\n\n$(strip(str, '\n'))")
end
end

Expand Down

0 comments on commit 342497b

Please sign in to comment.