Objective: Need to implement a hook to check group_list parameter
Below is the Hook that I have tried to create
import pbs
import sys
try:
if pbs.event().queue.name == “workq” and not pbs.event().job.group_list:
pbs.event().reject(“Job has been rejected as group list is not defined”)
except SystemExit:
pass
except:
pbs.event().reject(“Job rejected as group list has not been defined”)
Below is the job which runs a very simple python code and has group list parameter
So as an output in both positive and negative case it displays the message from the except block. I have tried various ways for group_list check but nothing is working out.
Expectation: If group list parameter is empty job should not execute and return error message which is present in expect in case if its present the job should get executed successfully
qmgr -c ‘create hook Grouplist event=“queuejob”’
qmgr -c ‘import hook Grouplist application/x-python default Group_List_Hook.py’