AWA Hostgroup is unable to go to the next available Agent on the list

Document ID : KB000119936
Last Modified Date : 05/11/2018
Show Technical Document Details
Issue:
A job using Hostgroup is unable to locate the next available host in the list when the job fails and is restarted.

Investigation
A. Add Job that has agent group to workflow 
B. Make sure job is configured to fail 
C. Execute workflow and allow task to block 
D. Stop agent that job used while job is in blocked status 
E. Right click on job in workflow monitor and restart 

ACTUAL: It's stuck waiting for host even though there's another active host in the hostgroup 
EXPECTED: Agent switches to the next active agent and completes the job 
Cause:
It is by design that the restart of a job will get executed with the same agent assignment it failed with on the initial run.
Resolution:
Workaround:

Do the following in the pre-process of the job:
:set &hnd# = prep_process_agentgroup(AE.19147.HOSTG.UNIX, , 'ALL', ) 
:process &hnd# 
:set &ag# = get_process_line(&hnd#, 1) 
:set &alive# = get_process_line(&hnd#, 2) 
:p ag: &ag# - active: &alive# 
:if &alive# = 'Y' 
:put_att HOST = &ag# 
:endif 
:endprocess