# Setting node\_group\_key in a hook

**URL:** <https://community.openpbs.org/t/setting-node-group-key-in-a-hook/3248>\
**Category:** Users/Site Administrators\
**Created:** [August 15, 2022, 4:49am UTC](https://community.openpbs.org/t/setting-node-group-key-in-a-hook/3248 "2022-08-15T04:49:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![israel.casas.84](https://avatars.discourse-cdn.com/v4/letter/i/aca169/32.png) [@israel.casas.84](https://community.openpbs.org/u/israel.casas.84)\
**Post date:** [August 15, 2022, 4:49am UTC](https://community.openpbs.org/t/setting-node-group-key-in-a-hook/3248/1 "2022-08-15T04:49:32Z")

</div>

Hello,

I have a problem while writing a queuejob hook. Im struggling to set _node\_group\_key_. Im following Section 5.2.4.3 (Plugins (Hooks) Guide) but it seems im missing something or doing something wrong. The way I already tried is:

pbs.event().job.node\_group\_key = pbs.node\_group\_key(“Resource\_Name”)  
pbs.event().job.Resource\_List[“node\_group\_key”] = “Resource\_Name”

The resource Im specified it does actually exists.

Am I missing something?

Much appreciate your support.

---

<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:** [July 3, 2023, 11:17pm UTC](https://community.openpbs.org/t/setting-node-group-key-in-a-hook/3248/2 "2023-07-03T23:17:31Z")

</div>

The node group key is a server and/or queue resource, not a job resource.

You set it on server and queues to tell the scheduler what resources to use to make placement sets when selecting nodes for a job. A job doesn’t get to determine that.

If you want ad-hoc placement sets for a job, you probably want -lplace=group=, which will ensure all nodes will have the same value for the resource listed.
