IDEA Background Tasks (As of 5261)

IDEA Background Tasks (As of 5261)
or How to make Demetra "Ready for DualCores"

In some of the previous topics, I had mentioned with Inspect Code, Locate
Duplicates, and the Find commands, you need to be able to run these tasks
in the background. Actually, that should be the default.

All long-running tasks should:
1) Run in the background by default.
2) Don't steal the focus or interfere with user while running or after completion
3) Don't show progress bar covering the editor.
progress should be shown the status bar or in a status/progress toolwindow
4) If the results window for the task is being updated to reflect the currently
found results, it should also give indication that the command is still running
and have toolbar button to stop it.

Users never want to see a modal progress bar; And the users with dual core
workstations are even more annoyed because they have one cpu sitting idle
while IDEA is blocking input! I personally use the Inspect Code feature less
than I would like because I can't launch it in the background while I do other
work.

I have seen Jetbrains make some positive changes in this area in Demetra, and I hope
more are coming.

Demetra has a new option General->Search in the background. If enabled, when you do
a Search, Search & Replace, Structural Search, or Structural Search & Replace (but not
a Find Usages), the modal progress dialog is not shown. Instead, the progress is displayed
in the status bar along with a red button to cancel the operation.

Currently, it looks like IDEA is behind Eclipse in this area. Eclipse did a major overhaul
in 3.0 M9 to add a new UI framework for background operations. See
http://help.eclipse.org/help31/index.jsp?topic=/org.eclipse.platform.doc.user/gettingStarted/qs-responsiveUI.htm
In particular, Eclipse properly shows two or more background tasks in the Progress Dialog or Progress
View.

In the following sections, I am going to cover some of the main areas which need to be improved
to make IDEA more pleasurable by getting rid of modal progress dialogs and making all long
tasks run in the background.

Previous Topics:

Ant Requests: http://www.intellij.net/forums/thread.jspa?threadID=210841
Find Requests: http://www.intellij.net/forums/thread.jspa?threadID=197579
JSP Requests: http://www.intellij.net/forums/thread.jsp?forum=22&thread=190614
Inspection UI Requests: http://www.intellij.net/forums/thread.jsp?forum=22&thread=193582

16 comments
Comment actions Permalink

All long running tasks should have the option to go into the background by default.
Most of IDEA's long running tasks have Results toolwindows. For those, there should be no
background window displayed. The toolwindow should give an indication that is is running
by have the button greyed out and have a stop button to stop the process.

IDEA Demetra is showing the background task progress in the status bar with a red button to
cancel the operation. There are couple problems with this. First, if you hae multiple
background tasks, what happens is the tasks step on each other in the status bar. You'll
see "12% Searching for 'progresss'..." and then you'll see "48% Searching for 'donuts'...",
etc. Also, the red cancel button applies only to the one of the tasks.

Here are some general UI changes I would like to see:

Results Toolwindow:
+ Results Toolwindows should have a green button. The button should be disabled when
the task is running. (Currently on some toolwindows the button is always enabled. If you press
it again, it seems to start another task instead of cancelling and restarting.).

+ Results Toolwindows should have a red stop button to stop the task. This will allow you
to stop the task. You should still be able to view the results collected so far. Users should click
the red button if they want to cancel and close the Results ToolWindow.

+ If You click the red to close a Results ToolWindow while a task is running in the background,
the associated background task needs to be cancelled. (Currently this is not happening in 5261.
You have to click the red button in the status bar.) (NoJira#)

Modal Progress Dialog:
+ All progress bars should have Cancel and Background buttons. Find Usages, for example, doesn't
have a Background button. (IDEABKL-2299) Also, the Cancel and Background buttons appear to be very buggy on
the progress dialogs that have them. This is low priority, because the goal is get rid of all
modal progress dialogs by default.

+ The status bar should show the progress of the last background task started. If this task
is finished, then display the next most recently launched background task, and so on. Basically
the background tasks are pushed onto a stack, and when a task is finished, it is removed from
the stack. Only the current task at the top of the stack has it's status displaye in the status
bar. Then, it is clear which task you are cancelling if you press the big red cancel button
in the status bar.

+ Add a new Progress ToolWindow which would show the progress of all background tasks. This will
look similar to the Eclipse Progress View. Each background task should show progress and have a
cancel button. Also, clicking on the progress could take you to the corresponding results toolwindow.


Options:
+ Expand General->Search in the background to include all long-running operations, similar to
Eclipse General->Always run in background. For example, Inspect Code,
Local Duplicates, Find Usages, Layout Code in package, Synchronize Project, etc.

+ The default for General->Search in the background should be Enabled!

Similarly, the Ant Build File Properties Make Build in Background should be Enabled by default
when adding a new ant build.xml file.

Are there any other places where we have 'Run in background' options in IDEA?

0
Comment actions Permalink

Support for Dual Core: Inspect Code should run in the background (AlexL)
http://www.jetbrains.net/jira/browse/IDEA-6910

Support for Dual Core: Locate Duplicates should run in the background. (AlexL)
http://www.jetbrains.net/jira/browse/IDEA-6909

Suport for Dual Core: Analyze Dependencies, Analyze Cyclic Dependencies,
Analyze Backward Dependencies, Analyze Module Dependenciese should run in the
background
http://www.jetbrains.net/jira/browse/IDEA-6912

If I start an Inspect Code, I should be able to still work on my code, and even run other searches like
Find Usages, while the Inspect Code is running in the background.

Ideally, I would like to queue up multiple Inspect Code tasks and have them run sequentially. The
Progress ToolWindow could show these Inspect Code tasks that are queued up to be run. It would be
nice to have a simple option like how many Analysis tasks to run concurrently with a default as 1,
but also let the user override this when they launch the task.

0
Comment actions Permalink

Related Jira Request I filed earlier:

IDEA should support launching multiple search and/or analysis tasks in the background. (AlexL)
http://www.jetbrains.net/jira/browse/IDEA-6913

IDEA should support launching multiple search and/or analysis tasks in the background.
There should be user-configurable property to set the maximum number of concurrently
running tasks (typically the user would set this to match number of cpus or cpus -1).
The user would still be able to queue up an unlimited number of tasks to run, but only
max-concurrent tasks would run at one time.

I should be able to launch a couple Inspect Code analysis in the background, and then
a couple Find Usages, etc.

0
Comment actions Permalink

The addition of the option General->Search in the background is big improvement.
Now, I don't need to see a modal progress dialog when I Find in Path, Replace
in Path, Search Structurally, Replace Structurally. I assume this is a work in
progress, and further improvement will be seen, but I will go ahead and list
the issues i see.

+ The Find Results toolwindow doesn't have a red stop button like you see
on the Messages - Make toolwindow. (No Jira#)

If possible, I would like the green arrow button change into a red
stop button while the task is running. Pressing stop would then change the
button back to green arrow button .

I actually don't like the behavior of the red stop button on the Make -
Messages window because it stops the build plus it clsoes the dialog. I would
change the stop button on Make - Messsages window to behave the same as above -
switch between green arrow and stop button, and then add a red close
button to the Make - Messages window that would stop the build and close the
tooolwindow.

+ If I close the Find Results window while the search is happening, it doesn't
cleanup properly. The status bar is still showing the search progress bar. I
have to hit the cancel button in the status bar to make it go away. (No Jira#)

+ Find Usages - The Progress dialog for Find Usages doesn't have a Background button.

+ Find Usages - The Find Usages doesn't run in the background if you have
General->Run in the background enabled.

0
Comment actions Permalink

Related Jira Request:

missing background option in find usages
http://www.jetbrains.net/jira/browse/IDEABKL-2299

0
Comment actions Permalink

One personal pet peeve of mine and potentially long running task is project
synchronization (File->Synchronize).

I had to uncheck the General->Synchronize files on frame activiation because everytime I
would switch back to IDEA, IDEA would freeze for 6 to 8 seconds while it synced up.

Ideally, synchronization should be able to happen in the background. If I have a DualCore
workstation, IDEA could synchronize using one cpu while I continue doing whatever I need
to do. I realize that might be very difficult for Jetbrains to do, even if they restrict
what you can do while it is synchronizing.

I would rather the following changes.
+ Add option to choose the scope for the synchronization on frame activation with the choices
All Project Files, All Editor Tabs, Current File.

By setting it to All Editor Tabs, this would make synchronization really quick for the cases where
I need to switch to a telnet console to make a file editable and then switch make to IDEA.

+ Each time I run an Ant Task, it synchronizes afterwards. So all my Ant tasks take a minimum of 6-8
seconds. Most of the time, the Synchronization is uneeded. I would like a property on my Ant Build File
Synchronization after excecution that I could disable.


Related to File Synchronization, it would be nice if we are opening another project in a new window,
if we could continue to use the current project.

0
Comment actions Permalink

The following commands display a progress dialog without any option to
run them in the background. It would be nice if they could be run in the background.
Version Control->Commit Project
Version Control->Update Project

I'm not sure how IDEA would handle the case if you edit a file during the update
or commit. Could IDEA allow the edit on a copy of the file, and then upon finish
fo the commit or update, it could then save the edits as a new revision?
That sounds complicated. It would be useful even if you had ther restriction you cannot
make any changes to the module while the task is running. You should still be able to
do read-only stuff, or edit a different module or project.
Anyway, if there is some way to do this, it would be nice.

0
Comment actions Permalink

Is anyone familiar with Eclipse's VCS integration? Can it update your files as a background task?

0
Comment actions Permalink

While trudging through the Jira IDEA Swamp and IDEABKL Dump, I found the following bugs were Obsolete. Please close them.

OBSOLETE Long running structural replace - no indication of progress
http://www.jetbrains.net/jira/browse/IDEABKL-2757

OBSOLETE "Find" toolwindow should not be shown until I press "stop" or "background"
http://www.jetbrains.net/jira/browse/IDEABKL-1819

OBSOLETE Very annoying multiple progress dialogs
http://www.jetbrains.net/jira/browse/IDEABKL-212

OBSOLETE No way to tell when synchronization is done
http://www.jetbrains.net/jira/browse/IDEABKL-354

OBSOLETE On-the-fly code compilation
http://www.jetbrains.net/jira/browse/IDEABKL-618

0
Comment actions Permalink

I found this Jira request which was related to long running tasks you might run in the background -- in particular, to Inspect Code, Locate Duplicates, Analyzed Dependencies tasks which can take an hour or more to run on very large workspaces. (Assuming they don't run out of memory first! :) )

I guess the alterntaive is to have your spiffy new IntelliJ Team Server run your Inspect Code batch jobs and then mail you a notification when they are complete. That is probably better since many mail clients/checkers have mail filter actions to play sound effects.

Incorporate sound cues into UI
http://www.jetbrains.net/jira/browse/IDEABKL-212

It would be really nice to have sound cues play after certain tasks complete,
such as a successful build, failed build, breakpoint hit, etc.

Sometimes these things take long enough that I shuffle the window into the
background and do something else while waiting for it to complete. It's nice to
hear a little 'ding' when lengthy tasks complete

0
Comment actions Permalink

Hi Alex,

A> Is anyone familiar with Eclipse's VCS integration? Can it update your
A> files as a background task?

Yes, in 3.x versions vcs operations can be sent to background. Also, initiating
new tasks while other long tasks are executing in background results in the
new ones being queued, so as to not interfere with the already executing
ones (not a bad idea, imo).

Best,
Andrei


0
Comment actions Permalink

> Also,

initiating new tasks while other long tasks are executing in background
results in the new ones being queued, so as to not interfere with the
already executing ones (not a bad idea, imo).


So I can't search in files while I compile?
Sounds like a bad idea to me.

0
Comment actions Permalink

Alex wrote:

I'm not sure how IDEA would handle the case if you edit a file during the update
or commit.


In the ideal case, IDEA would use the local VCS and commit the file
using a snapshot from the time you started the commit operation.

The update can prompt to do 3 way merge between the snapshot since the
start of the update operation, your last changes and the CVS copy (cvs
copy goes in the middle).

That speaking, it would be also cool if IDEA used the local VCS for
running inspections incrementally analyzing the changed files since the
last inspection with the same profile.

0
Comment actions Permalink

dimitar wrote:

In the ideal case, IDEA would use the local VCS and commit the file
using a snapshot from the time you started the commit operation.


In fact, we can generalize that if every long-running task can receive
it's own snapshot of the PSI and the VFS, we can safely run all of them
even in parallel.

After the task has finished, the view should receive batched all the
change events since after the snapshot timestamp just as if the user
waited for the task to complete and then changed the files using the editor.

And after that, if the particular task supports incremental processing,
we can rerun it to pick up the changes (which should take much less
time.) The incremental changes would be much easier to support if the
task keeps a copy of the original snapshot and compare it with the
latest version.

0
Comment actions Permalink

Great list. I would also add compilation and Ant-based build to the potentially long-running tasks which should be in the background by default. Right now you can push these to the background, but the default is foreground and unchangeable. Not a problem if you only have one or two projects, but really tedious if you have a lot of projects and have to set it every time.

Structural search also needs to go on your list of long-running tasks. Structural replace is probably not recommended for backgrounding, for the same reason refactorings aren't.

OpenAPI for background tasks that use the PSI would enable tools like MetricsReloaded to run their analyses in the background, greatly enhancing their interactive usability.

Finally, my killer "how are we going to use these multiple cores" feature is continuous testing, but that's still a bit science fiction for now.

--Dave Griffith

0
Comment actions Permalink

Hi Stephen,

SK> So I can't search in files while I compile?
SK> Sounds like a bad idea to me.

It's been a while since I used it and I don't have it installed, but I believe
the queuing happened for actions that would somehow depend on each other
(like starting an update while the IDE compiles, or vice-versa). I don't
think a search would be prevented while the compilation was in progress.

But no matter how the Eclipse guys chose to do it, I trust jetbrains can
do it better. ;)

Best,
Andrei


0

Please sign in to leave a comment.