Term.jl
Term.jl copied to clipboard
ProgressBar Issues
MWE: Adjust inputs to slightly strain your machine. I am running in VSCode for Windows.
using GLMakie, Term, Term.Progress
f1(x) = for i in 1:x; println(i); end; sleep(4)
f2(x) = collect(1:x)
f3(x) = lines(1:x, 1:x)
function main(x, y, z)
progressbar = ProgressBar(; columns=:minimal, columns_kwargs = Dict(:SpinnerColumn => Dict(:spinnertype => :circle)))
output = with(progressbar) do
job1 = addjob!(progressbar, description = "Running Function 1")
start!(job1)
yield()
sleep(0.001)
f1(x)
stop!(job1)
job2 = addjob!(progressbar, description = "Running Function 2")
start!(job2)
yield()
sleep(0.001)
f2(y)
stop!(job2)
job3 = addjob!(progressbar, description = "Running Function 3")
start!(job3)
yield()
sleep(0.001)
f3(z)
stop!(job3)
"Output"
end
return output
end
main(40, 1E9, 1E5)
-
job1
spinner appears but does not spin. -
job1
checkmark does not appear until bothjob1
andjob2
are complete. -
job2
spinner does not appear. The text and checkmark only appear once finished. -
job3
does not appear at all including text, spinner, and checkmark. - The output text lines above the top of the REPL window are deleted.
-
output
does not appear.
Same behavior whether I use yield()
or sleep(0.001)
.
working on it: https://github.com/FedeClaudi/Term.jl/pull/124
Hi,
Sorry for the delay in getting back to you. There were a few issues with threading and the timing between when jobs were stopped and the progress bar display updated. It works fine in the development branch with this code:
using Term, Term.Progress
f1(x) = for i in 1:x; println(i); end; sleep(0)
f2(x) = collect(1:x)
f3(x) = collect(1:x).^2
function main(x, y, z)
progressbar = ProgressBar(; columns=:minimal, columns_kwargs = Dict(:SpinnerColumn => Dict(:spinnertype => :circle)))
output = with(progressbar) do
job1 = addjob!(progressbar, description = "Running Function 1")
f1(x)
stop!(job1)
job2 = addjob!(progressbar, description = "Running Function 2")
f2(y)
stop!(job2)
job3 = addjob!(progressbar, description = "Running Function 3")
f3(z)
stop!(job3)
"Output"
println("Output2")
end
return output
end
main(50, 1E9, 1E5)
https://user-images.githubusercontent.com/17436313/182002672-13501e69-8f8e-4f29-9314-9eedf13ff8f7.mov
I think don't understand 5: if I say call f1
with x=100
so that a few lines are scrolled above the terminal's height, I can scroll back up and find them.
For issue 6, that was a bug due to a typo, will be fixed in the next release
Great, thanks. I think issue #5 I was having is not a term issue.
I still get the same behavior described in my first post on the master branch.
With your code on the 1.0.3 branch, I get the following static steps:
With my code on the 1.0.3 branch, I get the following static steps:
There is no spinning at any point and my terminal text is still cut off when I scroll back up:
I'll close this for now as new versions have been released and ProgressBar has been re-worked somewhat. Please get in touch if it's still an issue.