# Execjob\_prologue hook quesetion

**URL:** <https://community.openpbs.org/t/execjob-prologue-hook-quesetion/1746>\
**Category:** Users/Site Administrators\
**Created:** [August 26, 2019, 9:36am UTC](https://community.openpbs.org/t/execjob-prologue-hook-quesetion/1746 "2019-08-26T09:36:30Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![squallabc](https://avatars.discourse-cdn.com/v4/letter/s/898d66/32.png) [@squallabc](https://community.openpbs.org/u/squallabc)\
**Post date:** [August 26, 2019, 9:36am UTC](https://community.openpbs.org/t/execjob-prologue-hook-quesetion/1746/1 "2019-08-26T09:36:30Z")

</div>

Hi ,

we have a query on execjob\_prologue hook.

when job dispatched to a host, execjob\_prologue hook will check some setup before the job start running. if something on the host is wrong, the job will be rejected.

the basic function works fine. however, the job seems not to be requeued, it will be always dispatched on the same host and run 20 times then get HELD status.

could you provide some suggestion how to avoid this ?

Thanks

---

<div class="post-metadata">

**Author:** ![smgoosen](https://avatars.discourse-cdn.com/v4/letter/s/53a042/32.png) [@smgoosen](https://community.openpbs.org/u/smgoosen)\
**Post date:** [August 26, 2019, 2:54pm UTC](https://community.openpbs.org/t/execjob-prologue-hook-quesetion/1746/2 "2019-08-26T14:54:26Z")

</div>

You could offline the vnode if the health check fails. From the Hooks Guide:

```
vnlist = pbs.event().vnode_list
for v in vnlist.keys():
   vnlist[v].state = pbs.ND_OFFLINE
   vnlist[v].comment = "bad configuration"
pbs.event().reject("not accepting jobs")
```

---

<div class="post-metadata">

**Author:** ![squallabc](https://avatars.discourse-cdn.com/v4/letter/s/898d66/32.png) [@squallabc](https://community.openpbs.org/u/squallabc)\
**Post date:** [August 28, 2019, 4:30am UTC](https://community.openpbs.org/t/execjob-prologue-hook-quesetion/1746/3 "2019-08-28T04:30:19Z")

</div>

Thanks for the reply.  
however, we run the health check on pbsuser level, I think offline action requires pbsadmin .

any suggestion on this ?

Thanks.

---

<div class="post-metadata">

**Author:** ![adarsh](https://avatars.discourse-cdn.com/v4/letter/a/f07891/32.png) [@adarsh](https://community.openpbs.org/u/adarsh)\
**Post date:** [August 29, 2019, 2:23pm UTC](https://community.openpbs.org/t/execjob-prologue-hook-quesetion/1746/4 "2019-08-29T14:23:25Z")

</div>

+1 @smgoosen suggestion

@squallabc : wanted to get your input here, what would you like to do

- with respect to the job ? - do you want check the run\_count on that job and put it on user hold and later admin can qalter the job or check why the job has run\_count of more than 1 ( or X )

- with respect to the node that has issues ? # cronjob or user level cronjob on the nodes

- would you be to get the list of exec vnodes given to a job in the RUNJOB hook, check their status using remote ssh from with the script for the node health , if OK process , otherwise, put it back in the queue with a message or if the exec node in the list is buggy one (which you know) , then reject the job and put it back in the queue.

---

<div class="post-metadata">

**Author:** ![smgoosen](https://avatars.discourse-cdn.com/v4/letter/s/53a042/32.png) [@smgoosen](https://community.openpbs.org/u/smgoosen)\
**Post date:** [August 29, 2019, 3:21pm UTC](https://community.openpbs.org/t/execjob-prologue-hook-quesetion/1746/5 "2019-08-29T15:21:10Z")

</div>

Could I ask why you’d run a node health check as a user and not root?

---

<div class="post-metadata">

**Author:** ![vstumpf](https://avatars.discourse-cdn.com/v4/letter/v/dbc845/32.png) [@vstumpf](https://community.openpbs.org/u/vstumpf)\
**Post date:** [August 29, 2019, 8:31pm UTC](https://community.openpbs.org/t/execjob-prologue-hook-quesetion/1746/6 "2019-08-29T20:31:36Z")

</div>

You can set the hook’s fail\_action to offline\_vnodes. If the hook encounters an unhandled exception or hits the alarm, it will offline the vnodes.

This works even if the hook’s user is pbsuser.

---

<div class="post-metadata">

**Author:** ![squallabc](https://avatars.discourse-cdn.com/v4/letter/s/898d66/32.png) [@squallabc](https://community.openpbs.org/u/squallabc)\
**Post date:** [August 30, 2019, 2:21am UTC](https://community.openpbs.org/t/execjob-prologue-hook-quesetion/1746/7 "2019-08-30T02:21:34Z")

</div>

some dirs are only access by user only . so even root is not able to access. that 's why we need to use pbsuser to run the health check.  
Thanks.

---

<div class="post-metadata">

**Author:** ![squallabc](https://avatars.discourse-cdn.com/v4/letter/s/898d66/32.png) [@squallabc](https://community.openpbs.org/u/squallabc)\
**Post date:** [August 30, 2019, 2:24am UTC](https://community.openpbs.org/t/execjob-prologue-hook-quesetion/1746/8 "2019-08-30T02:24:15Z")

</div>

Thanks. let me try this and update the result.
