IsSynchronous

摘要

Determines if a tool is running synchronous or asynchronous. When a tool is synchronous, the results are automatically returned, but no other action may be taken until the tool has completed. All non-server tools are synchronous. Server tools may be asynchronous, meaning that once the tool has been submitted to the server, other functionality can be run without waiting, and the results must be explicitly requested from the server.

语法

IsSynchronous (tool_name)
参数说明数据类型
tool_name

The name of the tool to determine if it is synchronous.

String
返回值
数据类型说明
Boolean

A return Boolean value of True indicates the tool is synchronous.

代码示例

IsSynchronous example

Determine if a server tool is running synchronous.

import arcpy
import time

# Add server toolbox from a local ArcGIS Server
#
arcpy.ImportToolbox("pondermatic;buffertools")

# Create and load a recordset object for the tool's input
#
recSet = arcpy.RecordSet()
recSet.load("c:/temp/lines.shp")

# Run the server tool
#
results = arcpy.BufferLines_mytools(recSet, "100")

# If the tool is asynchronous, wait until the task is finished (status = 4)
#
if not arcpy.IsSynchronous("BufferLines"):
    while results.status < 4:
        time.sleep(0.01)

# Get output from task and export to a feature class on disk
#
result = results.getOutput(0)
result.save("c:/temp/bufferlines.shp")

相关主题


7/10/2012