Automic Workload Automation

  • 1.  Behavior For Each Workflow end state

    Posted Jan 16, 2017 08:19 AM
      |   view attached
    I can use some advice on manipulation of For Each Workflow end state.

    I have attached an example output from the Activities window. The Workflow Objects have status "ENDED_OK", but the child tasks in the For Each Workflow indicate failure.

    I have this scenario:
    - Standard Workflow with a few steps, including a For Each Workflow;
    - The For Each Workflow processes files;
    - The activities in the For Each Workflow are order dependent and if an error occurs then processing of the current file should stop;
    - The For Each Workflow should process all files, regardless if the previous file failed to process.

    I have added in all steps in the For Each Workflow a check on the return code of the Job. If that isn't 0, then I call MODIFY_STATE and that results in that Job exiting with status "ENDED_NOT_OK". The remaining activities in the For Each Workflow are not executed. That is exactly what I want.

    I cannot seem to make the For Each Workflow end with that same status (or any error), however.

    I would like to prevent adding a Script Object to either the For Each Workflow or Standard Workflow with the sole purpose of manipulating the end status of the For Each Workflow or top level Standard Workflow.

    Any suggestions?

    Alwin


  • 2.  Behavior For Each Workflow end state

    Posted Jan 16, 2017 09:32 AM
    Hi Alwin,

    Looks like you asked a similar question before. Please see link below. You should be able to achieve what you want through a dummy task inside the ForEach workflow or a PostCondition.

    https://community.automic.com/discussion/8280/abort-execution-in-for-each-workflow


  • 3.  Behavior For Each Workflow end state

    Posted Jan 16, 2017 10:08 AM
    Hi Christine,

    Thanks for the quick reply!

    The question that you are referring to has a requirement to actually abort the Workflow on error. This time around I have a flow where I want the opposite.

    I tried configuring a Postcondition on my Standard Workflow with "IF task ended with ANY_ABEND" THEN "Set return code to 900 with message 'Aborted on error'". It doesn't work. I figure this is due to the For Each Workflow exiting with ENDED_OK.

    The "END" activity in the For Each Workflow doesn't have any scripting tab. I tried configuring the "All states must match" on "FE(1)" with "ENDED_OK" and if so Abort, but that doesn't seem to work, either.

    As I mentioned here, I would like to avoid adding a "dummy task" to the For Each Workflow, simply because it would not actually add any functionality.

    Alwin


  • 4.  Behavior For Each Workflow end state

    Posted Jan 16, 2017 02:23 PM
    Which Version of Automation Engine do you use?

    As far as I remember in V9 there was a bug in the latest versions concerning FE WF.


  • 5.  Behavior For Each Workflow end state



  • 6.  Behavior For Each Workflow end state

    Posted Jan 17, 2017 05:49 PM
    @wolfgang: That link will cancel the FE workflow if a task has an error, which is basically doing the same thing in  the link I provided before.

    I think (correct me if I'm wrong Alwin) what he wants is:
    "The For Each Workflow should process all files, regardless if the previous file failed to process."
    So if FE workflow has 5 iterations (will loop 5 times), and the 4th iteration has an error, FE will abort the 4th iteration, but will still process/go through with the 5th iteration.
    Then at the end of FE workflow (after all 5 iterations are done), it will check if any of those iteration has an error. 
    If yes, then change the status of the FE workflow to 'abend' (or whatever status).
    Else, leave it 'ended_ok'.

    Is that correct..? 




  • 7.  Behavior For Each Workflow end state

    Posted Jan 18, 2017 05:42 AM
    Yes, Christine, you are on the right track. I am using UC4 10. Is it possible at all to configure this, or do I really need to add a custom Script that somehow checks if the current iteration in the loop is the final one?

    From a very technical perspective, since it is a Java application, I am hoping UC4 has something like:
    boolean configuredToAbortWorkflowOnError = <configuration>
    boolean configuredToExitWorkflowWithAbortOnAnErrorDuringLoop = <configuration>

    boolean abortWorkflow = false;
    boolean errorOccurred = false;
    for(int i = 0; i < $theVariableToLoopOn.length() && abortWorkflow == false; i++) {
      try {
        performStepsConfiguredInForEachWorkflow();
      } catch (Exception exception) {
        ...
        errorOccurred = true;
        if (configuredToAbortWorkflowOnError == true) {
          abortWorkflow = true;
        }
      }
    }
    if (errorOccurred == true) {
      if (configuredToExitWorkflowWithAbortOnAnErrorDuringLoop == true) {
        throw new ForEachWorkflowException("Aborted due to an error occurred in at least one of the loops.");
      }
    }