pharo-project / pharo

Pharo is a dynamic reflective pure object-oriented language supporting live programming inspired by Smalltalk.
http://pharo.org
Other
1.21k stars 355 forks source link

Job strangeness when progress: and title: are both updated #2815

Open fuhrmanator opened 5 years ago

fuhrmanator commented 5 years ago

I'm using Job to show progress bars on my code and I sometimes find that the message is "off by one" from the progress. I created a MWE below that reproduces the bug in Pharo 7 on Windows and Unix (WSL):

| myColl |
myColl := 1 to: 3.
[ :job | 
myColl do: [ :e | 
    job
        progress: e/(myColl size); 
    title: 'waiting ' , e asString.
    (Delay forSeconds: 3) wait ] ] asJob run

What I see is

So, from this I see a bug that the first message never appears and the last message and progress (3/3) never appears.

However:

The reason I'm interested in using both title: and progress: is that I have jobs with several long steps (cloning a git, creating metamodels, etc.) and I want to show progress along with a feedback for which step is running. This seems like a bug, but maybe I'm not using Job appropriately?

stale[bot] commented 5 years ago

To limit bug bankruptcy (see https://www.joelonsoftware.com/2012/07/09/software-inventory/) this issue has been automatically marked as stale because it has not had any activity in 6 months. It will be closed in 1 month if no further activity occurs. If this issue remains important to you, please comment to reactivate the issue. Thank you for your contributions.

Joel on Software
Software Inventory
Imagine, for a moment, that you came upon a bread factory for the first time. At first it just looks like a jumble of incomprehensible machinery with a few people buzzing around. As your eyes adjus…
jecisc commented 5 years ago

Keep

kamk commented 4 years ago

It has likely something to do with refresh rate defined in SystemProgressMorph>>update: When a small delay is added between sending progress: and title:, it looks like it works:

myColl do: [ :e | 
    job progress: e / (myColl size).
    (Delay forMilliseconds: 60) wait.
    job title: 'Waiting ', e asString.
    (Delay forSeconds: 2) wait ] ] asJob run
astares commented 5 months ago

Still valid in Pharo 12/Pharo 13