ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • 帮助
  • Sign Out
ArcGIS Desktop

ArcGIS Online

专为贵组织打造的制图平台

ArcGIS Desktop

全面的专业性 GIS

ArcGIS Enterprise

面向企业的 GIS

ArcGIS Developers

用于构建位置感知应用程序的工具

ArcGIS Solutions

适用于行业的免费模板地图和应用程序

ArcGIS Marketplace

获取适用于组织的应用程序和数据

  • 文档
  • 支持
Esri
  • 登录
user
  • 我的个人资料
  • 登出

ArcMap

  • 主页
  • 入门
  • 地图
  • 分析
  • 管理数据
  • 工具
  • 扩展模块

WorkflowExecutionResult

  • 描述
  • 讨论
  • 属性
  • 代码示例

描述

WorkflowExecutionResult对象提供在工作流中执行步骤的结果。

讨论

WorkflowExecutionResult 对象提供可指示步骤执行状态的返回代码。每一个步骤都有其各自的有效返回代码,并且可用来指引工作流的路径。

属性

属性说明数据类型
returnCode
(只读)

在工作流中执行一个步骤后返回的代码。此代码可指示步骤是成功还是失败,并可用于推动工作流的执行。

Integer

代码示例

WorkflowExecutionResult 示例

以下脚本演示了如何从步骤执行过程中获得返回代码。

import arcpy
import sys
import traceback


# Define the callback response function. In this case it will prompt the user using the console to respond.
def callback(question, responses):

    # Print out the expected responses
    for resp in responses:
        print("[%i] %s" + (resp[1], resp[0]))

    # Prompt the user to respond
    val = int(input("%s - %s: " % (question[1], question[0])))

    # Return their response. Currently only returning the value, but could also return a note (for questions) and the name of the response
    return val, "", ""


# Establish a connection to a Workflow database
conn = arcpy.wmx.Connect(r'c:\test\Workflow.jtc')

# Get a Job for Execution
job = conn.getJob(77601)

try:
    # Execute the current Step in the Job - a LaunchArcmap step without Proceed to Next enabled
    result = job.executeStep(callback=callback)

    # A Launch ArcMap step will not finish automatically it will be complete after the user indicates it is.
    if not result.finished:
        t = input("Please press any key and hit enter when finished step") 

        # Finish the step and Mark as Complete
        result.finishStep(callback=callback) 
        job.markStepAsComplete(callback=callback)

        # Run the next step in the workflow
        result = job.executeStep(callback=callback)

    print("Executing a 2nd step returned %i" % result.returnCode)
    
    # Mark the step as complete
    job.markStepAsComplete(callback=callback) 

except wmx.WorkflowExecutionStepError as e:
    print("Step failed to execute:")
    print("-"*60)
    traceback.print_exc()

ArcGIS Desktop

  • 主页
  • 文档
  • 支持

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

关于 Esri

  • 关于我们
  • 招贤纳士
  • Esri 博客
  • 用户大会
  • 开发者峰会
Esri
分享您的想法。
Copyright © 2021 Esri. | 隐私政策 | 法律声明