WorkflowExecutionError

Resumen

Se produce la excepción WorkflowExecutionError si un flujo de trabajo detecta un error de ejecución.

Debate

Se produce la excepción WorkflowExecutionError si no es posible ejecutar el flujo de trabajo. Por ejemplo, si el trabajo no está asignado al usuario actual o si el trabajo está cerrado, no es posible ejecutar el flujo de trabajo de un trabajo.

Muestra de código

La excepción WorkflowExecutionError se utiliza abajo para manejar los errores derivados de intentar ejecutar el flujo de trabajo.

import arcpy, sys, 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 workflow
	result = job.executeStep(callback=callback)
    
	print ("Executing the first step returned %i" % result.returnCode)
	
	#Run the next Step in the workflow
        result = job.executeStep(callback=callback) 
    
	#Mark the step as complete
	job.markStepAsComplete(callback=callback) 

#Raised when a step in the workflow encounters an execution error	
except wmx.WorkflowExecutionStepError as e:
    print ("Step failed to execute:")
    print("-"*60)
    traceback.print_exc()
	
#Raised when a workflow encounters an execution error
except wmx.WorkflowExecutionError as f:
    print ("Workflow failed to execute:")
    print("-"*60)
    traceback.print_exc()