Automic Workload Automation

Expand all | Collapse all

How To Skip one job in workflow if previous job has already skipped due to condition

  • 1.  How To Skip one job in workflow if previous job has already skipped due to condition

    Posted Nov 26, 2013 12:48 PM

     

    Hi Everyone
    It can be silly to ask but I could not managed it. I want to set the job status skipped if previous job skipped. I can describe it like this: in workflow "test" , there are jobs A and B. If A skipped due to pre-condition, B should be skipped , If A run then B should run.Problem is If I set dependency of B as A= ANY_OK else Block, it is running even A skipped.If I set A=ENDED_OK else Block then B is not running if A skipped. Putting in a box not an option for me. That can be so simple if there is no same post conditions in pre condition tab. If you did this already I will appreciate for answer.

    Thanks


  • 2.  How To Skip one job in workflow if previous job has already skipped due to condition

    Posted Nov 26, 2013 01:06 PM

     

    I able to achive that with using variable that included into A's pre-condition.


  • 3.  How To Skip one job in workflow if previous job has already skipped due to condition

    Posted Nov 27, 2013 09:26 AM

     I have similar situation where this is done by

    • a precondition on the first job (checks if a file exists, if notskip task elserun task)
    • a dependency on all the other jobs where status is ENDED_OK elseskip.

    This works like a charm! :)



  • 4.  How To Skip one job in workflow if previous job has already skipped due to condition

    Posted Nov 27, 2013 10:18 AM

     

    Hi

    Thank you for answer. I've tried that solution but when first job job fails depended job also skips, that i don't want to.Depended job should block the workflow.

     



  • 5.  How To Skip one job in workflow if previous job has already skipped due to condition

    Posted Nov 27, 2013 10:56 AM

    We created an Include that is used to test successor tasks to the name set in the &empty_task variable to determine if they are to execute or not.  This is needed since there is no discernible method (that we have ever figured out) of using the Dependencies Properties that allows, for example, task_1 to not execute due to a STOP NOMSG (Status 1910/ENDED_EMPTY) and then not execute multiple tasks not directly linked to that task.  These predecessor tasks are often File Transfers that may not execute due to a missing or empty file and we do not wish some number of successor task(s) to execute.

    The normal approach for us is to make a sub-process flow to follow task_1 that contains the multiple successor tasks.  That way there will be but a single task, the sub-process flow, that needs to check task_1’s status.  This Include allows the checking to occur in the Pre Process or Process tab of the successor task(s), and if task_1 ended with a STOP NOMSG so will the successor task using this Include.  The status of task_1’s completion is acquired from a GET_STATISTIC_DETAIL Script function that is not qualified by a run ID.

    The Dependency Status of the successor task(s) will most likely be ANY_OK.  Obviously a decision must be made between the appropriateness of using this facility or the normal sub-process technique.Hope this helps.

    ! COMMON_ENDED_EMPTY_TASK_CHECK Include
    !
    ! Sample use -
    !
    ! :SET &empty_task = "some_predecessor_task_name"
    ! :INC COMMON_ENDED_EMPTY_TASK_CHECK
    ! ! other logic as needed
    !
    :IF SYS_ACT_PARENT_NAME() NE " "
    ! Executing in a process flow
    : SET &status = GET_STATISTIC_DETAIL(,STATUS,&empty_task)
    : SET &end_time = GET_STATISTIC_DETAIL(,END_TIME,&empty_task)
    : IF &status EQ 1910
    ! ENDED_EMPTY / STOP NOMSG !
    :  SET &status = FORMAT(&status)
    :  SET &emsg = "&empty_task ended at &end_time with Status &status."
    :  PRINT "&emsg"
    :  PRINT " This task will not execute."
    :  STOP NOMSG,55,"&emsg"
    : ELSE
    :  PRINT "Execution continues,"
    : PRINT " &empty_task completed at &end_time with a Status of &status."
    :  ENDIF
    :ELSE
    : PRINT "Not executing as a task, execution continues."
    : ENDIF




  • 6.  How To Skip one job in workflow if previous job has already skipped due to condition

    Posted Nov 27, 2013 11:21 AM

    I see your point.

    What you could try is checking the status in a precondition of the second task. Not sure if it can be done by one of the magic &$STATUS# variables because those only work in a postcondition. Maybe create a workflow variable to store an initial value that you can check in auser defined if else construction in the precondition. And then leave the dependencies open because you take care of that yourself...



  • 7.  How To Skip one job in workflow if previous job has already skipped due to condition

    Posted Nov 27, 2013 12:49 PM

    Jeroen:

    I am unfamiliar with the magic &$STATUS# variable.  We are Version 8, is the new or is it something that I've missed all these years?



  • 8.  How To Skip one job in workflow if previous job has already skipped due to condition

    Posted Nov 28, 2013 02:35 AM

    @Mark: our posts crossed, I was responding to Gokmen.

    I am pretty new to Automic myself so I couldn't say if the &$STATUS# variable is available in version 8. I have used it only in version 10 and all it does is check the status of the Jobit is used in(afterwards). So if you want to use it in another Job, you have to capture it, and make sure it is available in the other Job.

    I like your solution because you can make use of standard functionality. Checking the name of the task might be a bit dodgy as the name of a Job can change and you won't find out until you run it... 



  • 9.  How To Skip one job in workflow if previous job has already skipped due to condition

    Posted Nov 28, 2013 04:38 AM

    Hi

    Mark 's answer is closest the solution , but if you using template jobs like me not is an option, because i could not set the job name because i am using same templates in different workflows for different jobs. As  Jeroen said , I am using workflow variable to pass condition to another. And we have another issue in v10 build 312 , SYS_ACT_PREV_NR can detect previous job's runid correctly but neither GET_UC_OBJECT_STATUS nor GET_STATISTIC_DETAIL can get job's status correctly. If it is not solved upgrade to 800/876 , will raise an issue.

    Thank you both of you for answers



  • 10.  How To Skip one job in workflow if previous job has already skipped due to condition

    Posted Nov 28, 2013 10:13 AM

    Well, I was going to suggest using the SYS_ACT_PREV_NAME/NR functions to determine predecessor task.  Remember that it does have the unfortunate restriction regarding multiple previous tasks and the runtime error that aborts the script.

    If you are not getting proper statistics using these functions then by all means you should open a ticket with Support as this is a rather basic function.  I'd also have them specifically identify that this issue is solved in whatever upgrade you intend to apply before going to the effort to perform an upgrade.




  • 11.  How To Skip one job in workflow if previous job has already skipped due to condition

    Posted Nov 29, 2013 03:42 AM

    I think I agree with Mark; his solution is better than mine...