ExecuteParseAndTransform randomly failing
Hi all, I am working on the Extensibility Rule to automate the Import/Validate/Load/etc. steps of a workflow, so that when the rule is called from a data management step it executes all workflow steps for a given workflow.
The first step of the workflow is a Workspace containing a dashboard, and the second is an Import step (we are using a direct connection).
The rule works generally fine, but the Import step randomly throws the following error:
"Cannot execute step because the prior workflow step is not completed...Source code: line 0, method ParseAndTransform"
This happens maybe less than 10% of the times, but it is annoying because I cannot understand the reason for it, since the Workspace step which precedes the Import step should always be completed since it is completed by the Extensibility rule itself.
These is an extract from the rule of how I complete and immediately after process the Import:
Dim CompleteWorkspaceWFInfo As WorkflowInfo = BRApi.Workflow.Status.SetWorkflowStatus(si, wfUnitClusterPK, StepClassificationTypes.Workspace, WorkflowStatusTypes.Completed, statusMessage, errorMessage, updateReason, Guid.Empty)
Dim Load As LoadTransformProcessInfo = BRApi.Import.Process.ExecuteParseAndTransform(si, wfUnitClusterPk, String.Empty, Nothing, TransformLoadMethodTypes.Replace, SourceDataOriginTypes.FromDirectConnection, True)Thinking it was maybe a timing issue of the ExecuteParseAndTransform sometime starting before OneStream had time to completely refresh the state of the Workspace step, I tried to add the following code between the 2 lines above:
' Get the current workspace step
Dim workspaceStep As StepInfo = BRApi.Workflow.Status.GetWorkflowStatus(si, wfUnitClusterPK, False).GetStep(StepClassificationTypes.Workspace)
' Loop a maximum of 3 seconds
For i As Integer = 0 To 2
' Check if the step has completed or encountered an error
If workspaceStep.Status.Equals(WorkFlowStatusTypes.Completed) Or workspaceStep.Status.Equals(WorkFlowStatusTypes.HasError) Then
Exit For
End If
'Introduce a delay of 1 seconds asynchronously
Await Task.Delay(1000)
NextHowever, this has not solved the issue, and the Await seems not to be triggered even when the ParseAndTransform throws the “prior workflow step is not completed” error. Does anyone have any idea of where the issue could reside or have seen something similar?
Thank you
