Package results in failure after successful task retry -
11-14-2006
, 08:20 AM
I'm trying to implement workflow in a DTS package such that a step is
retried if it fails. I've got the following code set up as an ActiveX
script in the workflow of Step 2.
Function Main()
Dim oPkg
Dim oStep
Set oPkg = DTSGlobalVariables.Parent
Set oStep = oPkg.Steps("DTSStep_CS_DTSSyncAdm.DTSSyncAdminData _1")
'Check status of previous result
If oStep.ExecutionResult = DTSStepExecResult_Failure Then
DTSGlobalVariables("retries").Value =
DTSGlobalVariables("retries").Value + 1
If DTSGlobalVariables("retries").Value >= 5 Then
'Only retry 5 times
Main = DTSStepScriptResult_DontExecuteTask
Else
'Retry up to 5 times
oStep.ExecutionStatus = DTSStepExecStat_Waiting
Main = DTSStepScriptResult_DontExecuteTask
End If
Else
'Previous result was successful
Main = DTSStepScriptResult_ExecuteTask
End If
End Function
This works almost perfectly. The first step does indeed retry up to 5
times. The problem is that, once that first step has finished with a
failure result, the overall package results in a failure even if the
first step ultimately finishes successfully (because of retries). Is
there any way that I can change the result of the first step to
indicate success?
I realize that the best solution would be to prevent the first step
from finishing in failure, but I'm dealing with an MS Commerce Server
custom task that is returning an error that I can't seem to track down.
If I restart the job, it runs fine.
My only other option would be to somehow set up the retry logic in the
SQL Agent job. That would require me to break the DTS package into
several smaller packages because I would only want to retry if there
was a failure on specific steps.
Mike Pearce |