# PP-677: Add YAML config files (.yml) to the supported list of config files for PBS hooks

**URL:** <https://community.openpbs.org/t/pp-677-add-yaml-config-files-yml-to-the-supported-list-of-config-files-for-pbs-hooks/443>\
**Category:** Developers\
**Created:** [February 17, 2017, 2:15am UTC](https://community.openpbs.org/t/pp-677-add-yaml-config-files-yml-to-the-supported-list-of-config-files-for-pbs-hooks/443 "2017-02-17T02:15:23Z")\
**Posts on this page:** 8\
**Page:** 1

<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:** [February 17, 2017, 2:15am UTC](https://community.openpbs.org/t/pp-677-add-yaml-config-files-yml-to-the-supported-list-of-config-files-for-pbs-hooks/443/1 "2017-02-17T02:15:23Z")

</div>

This note is to inform the community of work being done to add support for .yml files as pbs hook config files

[Support YAML formatted file as PBS hook config file](https://pbspro.atlassian.net/wiki/display/PD/PP-677%3A+Add+YAML+config+files+%28.yml%29+to+the+supported+list+of+config+files+for+PBS+hooks)

Please feel free to provide feedback on this topic

---

<div class="post-metadata">

**Author:** ![mkaro](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.openpbs.org/mkaro/32/85_2.png) [@mkaro](https://community.openpbs.org/u/mkaro)\
**Post date:** [February 17, 2017, 8:03pm UTC](https://community.openpbs.org/t/pp-677-add-yaml-config-files-yml-to-the-supported-list-of-config-files-for-pbs-hooks/443/2 "2017-02-17T20:03:21Z")

</div>

What is the motivation for supporting YAML?  
What version(s) of YAML will be supported?  
Will PBS Pro be linked against a YAML library?

---

<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:** [February 17, 2017, 10:12pm UTC](https://community.openpbs.org/t/pp-677-add-yaml-config-files-yml-to-the-supported-list-of-config-files-for-pbs-hooks/443/3 "2017-02-17T22:12:05Z")

</div>

It would be nice to give an example of a YAML configuration file, and how it might get invoked and processed in a hook script.

---

<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:** [February 27, 2017, 3:22pm UTC](https://community.openpbs.org/t/pp-677-add-yaml-config-files-yml-to-the-supported-list-of-config-files-for-pbs-hooks/443/4 "2017-02-27T15:22:04Z")

</div>

> [@mkaro](#):
>
> What is the motivation for supporting YAML?

YAML is a superset of json and allows the users to add comments

> [@mkaro](#):
>
> What version(s) of YAML will be supported?

1.2

> [@mkaro](#):
>
> Will PBS Pro be linked against a YAML library?

I would like to use the PyYAML library and install it locally on my machine. Then when the configuration file is imported, the python interpreter would check to see that it is correct YAML syntax. If so, the file is imported. If not, an error message is returned

---

<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:** [February 27, 2017, 3:50pm UTC](https://community.openpbs.org/t/pp-677-add-yaml-config-files-yml-to-the-supported-list-of-config-files-for-pbs-hooks/443/5 "2017-02-27T15:50:20Z")

</div>

Al,

Below is an example of the cgroups configuration file in YAML

```
# Cgroups config file
cgroup_prefix : pbspro
exclude_hosts :
        - node001
        - node002
# Exclude certain vnode types from running cgroups
exclude_vntypes :
        - disable_cgroups
        - login_node
run_only_on_hosts : []
periodic_resc_update : true
vnode_per_numa_node : false
online_offlined_nodes : true
use_hyperthreads : false
cgroup :
    cpuacct :
        enabled : true
        exclude_hosts :
            - node003
        exclude_vntypes :
            - red_node
    cpuset :
        enabled : true
        exclude_hosts :
            - node004
        exclude_vntypes :
            - green_node
    devices :
        enabled : false
        exclude_hosts : []
        exclude_vntypes : []
        allow :
            - b *:* rwm
            - c *:* rwm
            - ["mic/scif", "rwm"]
            - ["nvidiactl", "rwm", "*"]
            - ["nvidia-uvm", "rwm"]

    hugetlb :
        enabled : false
        exclude_hosts : []
        exclude_vntypes : []
        default : 0MB
        reserve_percent : 0
        reserve_amount : 0MB
    memory :
        enabled : true
        exclude_hosts : []
        exclude_vntypes :
            - blue_node
        soft_limit : false
        default : 256MB
        reserve_percent : 0
        reserve_amount : 1GB
    memsw :
        enabled : true
        exclude_hosts : []
        exclude_vntypes :
            - grey_node
        default : 256MB
        reserve_percent : 0
        reserve_amount : 1GB

```

To use this config in a hook do the following

import yaml  
with open(‘config.yaml’, ‘r’) as f:  
cfg = yaml.safe\_load(f)

Below are a couple of useful links to better understand YAML

- [https://learnxinyminutes.com/docs/yaml/](https://learnxinyminutes.com/docs/yaml/)
- [http://www.yaml.org/](http://www.yaml.org/)

---

<div class="post-metadata">

**Author:** ![subhasisb](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.openpbs.org/subhasisb/32/12_2.png) [@subhasisb](https://community.openpbs.org/u/subhasisb)\
**Post date:** [February 27, 2017, 3:53pm UTC](https://community.openpbs.org/t/pp-677-add-yaml-config-files-yml-to-the-supported-list-of-config-files-for-pbs-hooks/443/6 "2017-02-27T15:53:32Z")

</div>

There has been discussions about moving all configuration to PBS. Current design of hooks configuration files are not in line with that intended direction for PBS. Given that, why would we continue to enhance such configuration files.

If we were to support configuration files, then yes, yaml files are truely intended for that - not json files. However, given the direction we intend to go (i.e., move all configuration to qmgr), I think we should avoid doing these enhancements, and instead expend efforts to move away from the configuration files.

---

<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:** [February 27, 2017, 4:06pm UTC](https://community.openpbs.org/t/pp-677-add-yaml-config-files-yml-to-the-supported-list-of-config-files-for-pbs-hooks/443/7 "2017-02-27T16:06:41Z")

</div>

When and who made this decision? Where can I find it on the community page?

---

<div class="post-metadata">

**Author:** ![subhasisb](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.openpbs.org/subhasisb/32/12_2.png) [@subhasisb](https://community.openpbs.org/u/subhasisb)\
**Post date:** [February 27, 2017, 4:25pm UTC](https://community.openpbs.org/t/pp-677-add-yaml-config-files-yml-to-the-supported-list-of-config-files-for-pbs-hooks/443/8 "2017-02-27T16:25:17Z")

</div>

Not yet. Some of us are working towards putting that up on the community pages soon. We will update the community soon about the same. I will circle back and provide a link to that in this discussion thread as soon as we can put that up. That design guidance itself, obviously, will also be under community review.
