Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

precompile: add pid to waiting message #3583

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions src/API.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1274,21 +1274,22 @@ function precompile(ctx::Context, pkgs::Vector{PackageSpec}; internal_call::Bool
end

stderr_outputs = Dict{Base.PkgId,String}()
taskwaiting = Set{Base.PkgId}()
taskwaiting = Dict{Base.PkgId,String}()
pkgspidlocked = Dict{Base.PkgId,String}()

function monitor_stderr(pkg, iob)
try
while isopen(iob)
str = readline(iob)
stderr_outputs[pkg] = get(stderr_outputs, pkg, "") * str * "\n"
if !in(pkg, taskwaiting) && occursin("waiting for IO to finish", str)
if !haskey(taskwaiting, pkg) && occursin("waiting for IO to finish", str)
pid_str = strip(split(str, "waiting")[1])
!fancyprint && lock(print_lock) do
println(io, pkg.name, color_string(" Waiting for background task / IO / timer.", Base.warn_color()))
println(io, pkg.name, color_string(" $pid_str Waiting for background task / IO / timer.", Base.warn_color()))
end
push!(taskwaiting, pkg)
taskwaiting[pkg] = pid_str
end
if !fancyprint && in(pkg, taskwaiting)
if !fancyprint && haskey(taskwaiting, pkg)
lock(print_lock) do
println(io, str)
end
Expand Down Expand Up @@ -1362,8 +1363,9 @@ function precompile(ctx::Context, pkgs::Vector{PackageSpec}; internal_call::Bool
waiting = if haskey(pkgspidlocked, dep)
who_has_lock = pkgspidlocked[dep]
color_string(" Being precompiled by another $(who_has_lock)", Base.info_color())
elseif dep in taskwaiting
color_string(" Waiting for background task / IO / timer. Interrupt to inspect", Base.warn_color())
elseif haskey(taskwaiting, dep)
pid_str = taskwaiting[dep]
color_string(" $pid_str Waiting for background task / IO / timer. Interrupt to inspect", Base.warn_color())
else
""
end
Expand Down
Loading