Automic Workload Automation

Expand all | Collapse all

Deactivate "ENDED_OK" jobs in activity window

  • 1.  Deactivate "ENDED_OK" jobs in activity window

    Posted 10-28-2015 10:36 AM
    Hi,

    Is it possible, by script, to deactivate from the activity window all the jobs that are ended with status "ENDED_OK"?

    thx!!
    kind regards
    Sören


  • 2.  Deactivate "ENDED_OK" jobs in activity window

    Posted 10-28-2015 11:20 AM
    I assume this is a question regarding AE and not other Automic products though it is in the General Topics sub-forum.  I further assume that you are referring to tasks that do not have the Automatically deactivate when finished option appropriately checked in their Attributes tab.

    You can use the PUT_ATT  script statement with the AUTO_DEACT parameter in the object's Pre Process or Process tab.

    If you are on V10 and above you can use the DEACTIVATE_UC_OBJECT script function but that will require that you have a method to determine the task's RunID.

    Perhaps a more detailed description of the actual problem would help us in providing a more workable solution.  For example, what has been done with the object definitions that is preventing these tasks from not deactivating for an ENDED_OK status?


  • 3.  Deactivate "ENDED_OK" jobs in activity window

    Posted 10-29-2015 02:36 AM
    Hi Mark,

    Thanks for the answer. Indeed this is a question about the AE V10. We want to monitor and automataticly clenaup our activity window. We want to create a script that checks the activity window and 
    1. Deactivate all the "ENDED_OK" jobs; In several jobs it's not configured in the job attributes that the job must be "Automatically deactivate when finished / After error-free execution".
    2. Send an alert when there are jobs in a specific state (for example "Waiting for host"). For the "send alert" we use specific code, so that's no problem. 

    But to create this script, I have the issue that you described: "you can use the DEACTIVATE_UC_OBJECT script function but that will require that you have a method to determine the task's RunID." 

    Do you have an idea if it's possible to determine the RunID's of the tasks in the activity window in a specific state?
    thx!!


  • 4.  Deactivate "ENDED_OK" jobs in activity window

    Posted 10-29-2015 02:50 AM

    Hi SörenVandecauter610322. You might use a SQL VARA that executes an SQL on the AE database which returns all runid's of workflows with ENDED_OK and active state. Then you iterate trough the results and execute DEACTIVATE_UC_OBJECT on the results. Unfortunately I can't give you any hint on the required SQL but that's a way how it might work :). Personally I would go with Mark_Hadler_430s proposal as it is the most common way on how to proceed with this. There's no build-in function (I am aware of) that can iterate trough the activity window data.



  • 5.  Deactivate "ENDED_OK" jobs in activity window

    Posted 10-29-2015 03:08 AM
    Hi Joel , thanks for the answer :smile: . I will test with a SQL VARA to configure this. 


  • 6.  Deactivate "ENDED_OK" jobs in activity window

    Posted 10-29-2015 07:12 AM
    Solution found.
    Create VARA.SQLI (VARA.SQLI.CHECK_JOBS_STATUS_ENDED_OK) with this info:
    select EH_Client, EH_AH_Idnr, EH_Name, EH_Status, EH_HostDst
    from EH 
    where EH_Status = 1900
    AND EH_Client = 10
    order by EH_AH_Idnr

    Create script:
    :PRINT "CHECK JOBS IN STATUS 'ENDED_OK' FOR CLIENT 10"
    :PRINT "---------------------------------------------------"
    :SET &HND# = PREP_PROCESS_VAR(VARA.SQLI.CHECK_JOBS_STATUS_ENDED_OK)
    :PROCESS &HND#
    :  SET &RUNNR# = GET_PROCESS_LINE(&HND#,3)
    :  SET &JOB_NAME# = GET_PROCESS_LINE(&HND#,4)
    :  SET &STATUS# = GET_PROCESS_LINE(&HND#,5):
    :  PRINT "  &RUNNR# / &JOB_NAME#"
    :  SET &DEACTJOB# = DEACTIVATE_UC_OBJECT(&RUNNR#)
    :  IF &DEACTJOB# <> "0"
    :     SET &ERRNR# = SYS_LAST_ERR_NR()
    :     SET &ERRINS#  = SYS_LAST_ERR_INS()
    :     SET &MESSAGE# = GET_MSG_TXT(&ERRNR#,&ERRINS#)
    :     PRINT "&MESSAGE#"
    :  ELSE
    :     PRINT "DEACTIVATE OK"
    :  ENDIF
    :ENDPROCESS


  • 7.  Deactivate "ENDED_OK" jobs in activity window

    Posted 10-29-2015 03:22 PM
    Well done, let us know if you run into any kind of trouble with this solution :).


  • 8.  Deactivate "ENDED_OK" jobs in activity window

    Posted 11-12-2015 08:37 AM
    Hi, I need almost the same thing. And I have already made this VARA select. But I have problem with length of RUNID values. Our IDs are 9 digits long. Select unfortunately cuts last two digits so the list is useless. Is there any workaround about this? Or is there any other possibility to get list from Activities?


  • 9.  Deactivate "ENDED_OK" jobs in activity window

    Posted 03-15-2018 09:10 AM
    I know this is an old thread, and i came across it looking for something else, but i wanted to add my experience to avoid an issue we ran into when trying to automatically clear activities. 

    If you deactivate a job that ended_okay before the next job in a workflow is able to process its dependencies, that job (and workflow) will become hung in the state "waiting for predecessor" or "processing". To compound the issue, if that workflow is configured to only allow one active instance, then you have a situation where all future executions are hung.