Foreground and background processing

You can control whether tools execute in the foreground or background by clicking Geoprocessing > Geoprocessing Options on the Standard toolbar.

The Background processing panel is where you control whether a tool executes in foreground or background mode.

Background processing

When you execute a tool using its dialog box or from the Python window, you'll see the tool's progress as illustrated below.

Background processing progress bar and notification

You can also track progress in the Results window. The Results window can be opened in the following ways:

While a tool is running in the background, you can submit more tools to be run by using the tool dialog box. Only one tool will run in the background; all other tools will be pending (waiting to run). Once a tool finishes executing, the next pending tool will start executing.

You will not be able to start an edit session if there are tools running in the background. If there are tools running in the background, a message box appears notifying that the edit session cannot be started. You must allow all geoprocessing tools running in the background to complete (or cancel them) before beginning an edit session.

With background processing, when you execute a tool in the Python window, the Python window cannot be used until the tool has finished executing.

Custom model and script tools run in foreground by default

Your custom model and script tools will run in the foreground by default, even if you've enabled background processing. To allow your custom tools to run in the background, you must do two things:

  1. Ensure that your tool follows the guidelines specified in Running custom (model or script) tools in the background.
  2. Right-click your custom model or script tool and click Properties. On the General tab, uncheck Always run in foreground.

Affected ArcMap layers are locked when a tool is running in background

When the output of a geoprocessing tool is a layer in the map (such as with the Select Layer By Attribute tool) or the tool modifies the input data (such as the Add Field tool or any of the tools in the Editing toolbox), the layer will be locked while the tool is running. A lock icon will appear over the layer in the table of contents to signify the layer is locked for processing. Any refreshing of the map display while a layer is locked will result in the layer not being drawn. Once the tool has finished processing, the map display will refresh and you can resume work on the layer.

Canceling a tool executing in the background

To cancel the execution of a tool running in the background, open the Results window and find the tool that is currently executing (it will have an hourglass or processing clock icon next to it). Right-click the result and click Cancel. This method can also be used to cancel queued tasks that have not yet run.

When a tool receives the cancel instruction, it attempts to clean up after itself, deleting any data it created and issuing a warning message. Depending on the type of clean-up work the tool was doing, cancelling may take a few moments.

System tools may execute in foreground even when background is enabled

There are times when tools execute in the foreground even if background processing is enabled:

  • If you are editing data, all geoprocessing tools execute in the foreground. Even if the data you are editing is not used by geoprocessing tools, ArcGIS will still execute all tools in the foreground. This is to prevent a situation where a tool running in the background modifies data that you are editing.
  • If you open the ModelBuilder window and run a model, all processes in the model execute in the foreground. Working in the ModelBuilder window is similar to an edit session. Any processes run do so in the foreground to prevent a situation where changing the workflow could cause undesirable results.
  • Some system tools, such as the Upgrade Geodatabase tool, always run in the foreground due to data locking and integrity needs. Other system tools may run in the foreground if they need to access the current map document.

Exiting applications when tools are waiting or running in the background

From ArcMap (or ArcGlobe or ArcScene), you can exit and save the document while tools are running or pending. If you exit, all running tools will be stopped. The status of the running and pending tools will be changed to Not Run inside the saved document's Results window. These entries will have hollow icons and can be run by right-clicking the result and clicking Re Run.

A tool that is running or pending when ArcCatalog is exited will be immediately stopped. The result of the tool is moved to the Not Run section of the Results window. The tool can be rerun in the same way as previously mentioned.

Foreground processing

When background processing is disabled, tools execute in the foreground, and you must wait for the process to finish before you can use the application again. Once tool execution begins, the progress dialog box appears, as illustrated below. Click Details to view the execution messages.

Normal execution message

A warning message will appear as green text in the tool's messages, prefixed with WARNING followed by a numeric code. A warning means that the output may not contain what you expect. In the case illustrated below, the tool created empty output. The numeric code is a hyperlink—you can click it to view a full description of the warning and possible solutions.

An error message appears in red text, prefixed with ERROR followed by a numeric code.

Warning message

Once a tool executes and you close the progress dialog box, you can review all aspects of a tool's execution in the Results window.

Canceling a tool executing in the foreground

During tool execution, you can cancel execution by clicking the Cancel button on the progress dialog box.

When a tool receives the cancel instruction, it attempts to clean up after itself, deleting any data it created and issuing a warning message. Depending on the type of clean-up work the tool was doing, cancelling may take a few moments.

Performance considerations

Background processing can be thought of as another ArcMap session running on your computer but without the ArcMap window open. This additional process (session) is launched the first time a tool executes in the background and remains until you exit your ArcMap session. You will notice a brief delay on the first tool execution as the background process is started.

When working with large datasets, some geoprocessing tools, particularly those that use tiled processing, need as much of your computer resources (memory and CPU) as you can make available. If a tool you submitted for background processing fails because there is not enough memory available (error "000426: Out Of Memory" or error "999998: Unexpected Error"), you can try the following:

  1. Identify and exit nonessential memory-intensive applications.
  2. Disable background processing from the Geoprocessing Options dialog box (Geoprocessing > Geoprocessing Options). This shuts down the background process and frees up resources.
  3. Rerun the tool.

By following the above procedure, background processing is bypassed; the additional background process does not start, and the resources it would consume are now available for your tool to make use of. While the tool is executing, avoid starting any memory-intensive applications.

Dive-inDive-in:

Background processing actually starts two processes. You can observe the background processes through Windows Task Manager. On the Processes tab, you'll see the two RuntimeLocalServer.exe processes that make up background processing. These processes should never be ended through the task manager as this could produce unexpected results.

Related Topics

4/16/2013