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

ProgressBar Issues #123

Closed
nathanrboyer opened this issue Jun 21, 2022 · 5 comments
Closed

ProgressBar Issues #123

nathanrboyer opened this issue Jun 21, 2022 · 5 comments

Comments

@nathanrboyer
Copy link
Contributor

nathanrboyer commented Jun 21, 2022

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)
  1. job1 spinner appears but does not spin.
  2. job1 checkmark does not appear until both job1 and job2 are complete.
  3. job2 spinner does not appear. The text and checkmark only appear once finished.
  4. job3 does not appear at all including text, spinner, and checkmark.
  5. The output text lines above the top of the REPL window are deleted.
  6. output does not appear.

Same behavior whether I use yield() or sleep(0.001).
image

@FedeClaudi
Copy link
Owner

working on it: #124

@FedeClaudi
Copy link
Owner

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)
Screen.Recording.2022-07-31.at.00.49.54.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

@nathanrboyer
Copy link
Contributor Author

Great, thanks. I think issue #5 I was having is not a term issue.

@nathanrboyer
Copy link
Contributor Author

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:
image
image
image

With my code on the 1.0.3 branch, I get the following static steps:
image
image
image

There is no spinning at any point and my terminal text is still cut off when I scroll back up:
image

@FedeClaudi FedeClaudi linked a pull request Nov 30, 2022 that will close this issue
39 tasks
@FedeClaudi
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants