# Custom resource in hook not available

**URL:** <https://community.openpbs.org/t/custom-resource-in-hook-not-available/258>\
**Category:** Users/Site Administrators\
**Created:** [September 14, 2016, 9:30am UTC](https://community.openpbs.org/t/custom-resource-in-hook-not-available/258 "2016-09-14T09:30:25Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![vchlum](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.openpbs.org/vchlum/32/93_2.png) [@vchlum](https://community.openpbs.org/u/vchlum)\
**Post date:** [September 14, 2016, 9:30am UTC](https://community.openpbs.org/t/custom-resource-in-hook-not-available/258/1 "2016-09-14T09:30:26Z")

</div>

Hello,

I have a custom resource in server\_priv/resourcedef like this:  
scratch\_local type=size flag=h

When I submit a job like this:  
qsub -l select=1:scratch\_local=400MB

Is it possible to read the resource in a hook (execjob\_begin, execjob\_end, …)? It is not available in pbs.event().job.Resource\_List. Why I cant see it here?

Thx,  
VCh

---

<div class="post-metadata">

**Author:** ![alexis.cousein](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.openpbs.org/alexis.cousein/32/265_2.png) [@alexis.cousein](https://community.openpbs.org/u/alexis.cousein)\
**Post date:** [September 14, 2016, 10:18am UTC](https://community.openpbs.org/t/custom-resource-in-hook-not-available/258/2 "2016-09-14T10:18:06Z")

</div>

Sure it is. But it’s not listed separately, it’s part of Resource\_List[“select”], which you have to parse (not that hard, since chunk specifications are “+” separated and within these entries are “:” separated).

---

<div class="post-metadata">

**Author:** ![vchlum](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.openpbs.org/vchlum/32/93_2.png) [@vchlum](https://community.openpbs.org/u/vchlum)\
**Post date:** [September 14, 2016, 10:47am UTC](https://community.openpbs.org/t/custom-resource-in-hook-not-available/258/3 "2016-09-14T10:47:03Z")

</div>

Thank you for reply but pbs.event().job.Resource\_List.keys() is [‘walltime’, ‘ncpus’, ‘mem’, ‘place’]. No “select” here. I can parse pbs.event().job.exec\_vnode but not sure if this is the best way.

---

<div class="post-metadata">

**Author:** ![jon](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.openpbs.org/jon/32/23_2.png) [@jon](https://community.openpbs.org/u/jon)\
**Post date:** [September 15, 2016, 2:20am UTC](https://community.openpbs.org/t/custom-resource-in-hook-not-available/258/4 "2016-09-15T02:20:55Z")

</div>

In order for it to show up in the Resources\_List[“select”] line you will need to add it to the resources line in the sched config file. Please add your custom resource to the resources line in the sched\_config file and restart the scheduler.

---

<div class="post-metadata">

**Author:** ![vchlum](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.openpbs.org/vchlum/32/93_2.png) [@vchlum](https://community.openpbs.org/u/vchlum)\
**Post date:** [September 15, 2016, 11:22am UTC](https://community.openpbs.org/t/custom-resource-in-hook-not-available/258/5 "2016-09-15T11:22:39Z")

</div>

I already have the custom resource between resources in sched\_config.

---

<div class="post-metadata">

**Author:** ![vchlum](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.openpbs.org/vchlum/32/93_2.png) [@vchlum](https://community.openpbs.org/u/vchlum)\
**Post date:** [September 15, 2016, 1:20pm UTC](https://community.openpbs.org/t/custom-resource-in-hook-not-available/258/6 "2016-09-15T13:20:35Z")

</div>

Now I got it. Resources\_List[“select”] is available in the event runjob, not in the events execjob\_begin,execjob\_end,…

---

<div class="post-metadata">

**Author:** ![bayucan](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.openpbs.org/bayucan/32/24_2.png) [@bayucan](https://community.openpbs.org/u/bayucan)\
**Post date:** [September 16, 2016, 8:12pm UTC](https://community.openpbs.org/t/custom-resource-in-hook-not-available/258/7 "2016-09-16T20:12:52Z")

</div>

In a mom hook, you can ask the server for the value by doing (ala qstat -f):  
e=pbs.event()  
j=pbs.server().job([e.job.id](http://e.job.id))  
print j.Resource\_List[‘select’]
