search cancel

[AWA] How to write scripts that auto cancel manually job with status "Waiting for host"

book

Article ID: 113322

calendar_today

Updated On:

Products

CA Automic Workload Automation - Automation Engine

Issue/Introduction

Recently one of server down which caused agent inactive, but our Jobs with that agent still pending with "Waiting for the host" After 2 days we noticed of this, we had to cancel it manually. We want to check if possible that after certain period those jobs with "Waiting for the host" will be auto ended. How should we set up for this.

Environment

Release:
Component: AAUTEN

Resolution

SOLUTION 1:
You can use another Jobs run in another agent that active right after the main jobs (jobs that you want to cancel manually when Waiting for host status appear) active.
As you can see in the images, I use JOBS.WIN.NEW.4 to monitor JOBS.WIN.NEW.5.
- Put a script to active Jobs4 at the end of Jobs5 process

<Please see attached file for image>

User-added image
- Put in Jobs4 wait command for amount of time

- Put in Jobs4 post process the scripts that monitoring the Jobs5 status, and cancel Jobs5 when it has "waiting for host" status.

<Please see attached file for image>

User-added image


SOLUTION 2:
You can use a set of SQL VARA and a script object to perform cancel action. You can run the script every time you have "Waiting for host" job.

The SQL VARA statement is:
select EH_Ah_Idnr from EH where EH_status='1696'

<Please see attached file for image>

User-added image

The Script content is:
:SET &HND#=PREP_PROCESS_VAR(VARA.SQL.NEW.1)
:PROCESS &HND#
:SET &VK#=GET_PROCESS_LINE(&HND#,1)
! :   SET &VALUE# = GET_PROCESS_LINE(&HND#,2)
:SET &ACTION#=CANCEL_UC_OBJECT(&VK#,"ENDED_CANCEL")
:PRINT "&VK# &ACTION#"
:ENDPROCESS

<Please see attached file for image>

User-added image
 

Additional Information

Script to active another job in main job process
:SET &JNR# = ACTIVATE_UC_OBJECT(JOBS,JOBS.WIN.NEW.4)

Scripts to cancel manually job with "Waiting for host" status:
:SET &RUNNR# = GET_UC_OBJECT_NR(JOBS.WIN.NEW.5)
:SET &STATUS# = GET_UC_OBJECT_STATUS(JOBS,&RUNNR#)
:IF &STATUS# = "1696"
:SET &ACTION# = CANCEL_UC_OBJECT(&RUNNR#, "ENDED_CANCEL")
:ENDIF

 

Attachments

1558695899254000113322_sktwi1f5rjvs16ibh.png get_app
1558695897491000113322_sktwi1f5rjvs16ibg.png get_app
1558695895473000113322_sktwi1f5rjvs16ibf.png get_app
1558695893440000113322_sktwi1f5rjvs16ibe.png get_app