# License check and fetch the 3rd party license

**URL:** <https://community.openpbs.org/t/license-check-and-fetch-the-3rd-party-license/3744>\
**Category:** Users/Site Administrators\
**Created:** [January 2, 2024, 11:19am UTC](https://community.openpbs.org/t/license-check-and-fetch-the-3rd-party-license/3744 "2024-01-02T11:19:05Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ramesh](https://avatars.discourse-cdn.com/v4/letter/r/d07c76/32.png) [@Ramesh](https://community.openpbs.org/u/Ramesh)\
**Post date:** [January 2, 2024, 11:19am UTC](https://community.openpbs.org/t/license-check-and-fetch-the-3rd-party-license/3744/1 "2024-01-02T11:19:05Z")

</div>

Hi

I want to fetch the license in particular queue.  
we submits the jobs it will check a licenses available and fetch the 3rd party licenses in queue.  
How to configure the OpenPBS to fetch the licenses ?

---

<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:** [January 2, 2024, 12:01pm UTC](https://community.openpbs.org/t/license-check-and-fetch-the-3rd-party-license/3744/2 "2024-01-02T12:01:58Z")

</div>

Please follow this link and discussion:

> [@How to manage Flexnet Licensing in PBS Pro?](https://community.openpbs.org/t/how-to-manage-flexnet-licensing-in-pbs-pro/1025/2):
>
> qmgr -c “create resource hwu\_lic type=long” create a script in /usr/loca/bin/hwu\_lic.sh that queries the license server and outputs available number of tokens only (integer) Add it to the resources: line in the sched\_config resources: “ncpus, aoe, …,hwu\_lic” Add the server\_dyn\_res line server\_dyn\_res: “hwu\_lic !/usr/local/bin/hwu\_lic.sh” kill -HUP \< PID OF THE PBS SCHEDULAR \> Submit jobs qsub -l select=1:ncpus=1 -l hwu\_lic=100 – /bin/sleep 100 Please request the specific…

---

<div class="post-metadata">

**Author:** ![Ramesh](https://avatars.discourse-cdn.com/v4/letter/r/d07c76/32.png) [@Ramesh](https://community.openpbs.org/u/Ramesh)\
**Post date:** [January 2, 2024, 12:36pm UTC](https://community.openpbs.org/t/license-check-and-fetch-the-3rd-party-license/3744/3 "2024-01-02T12:36:46Z")

</div>

Hi Adarsh,  
Thanks for your reply.  
We have done the license availability check.  
We want to know how to fetch the licenses or hold the licenses for particular queue jobs with users?

Actually we are trying run parallel jobs with 10 licenses. Example: we submitted 10 jobs with 10 licenses, 1st job will be run with 10 license remaining jobs should be goes to queue state once 1st job completed after that 2nd job need to run with 10 licenses then same for remaining jobs will execute.

But from our side all jobs goes to running state because scripts compile time take 5 minutes then only licenses will fetch. So its not going to queue state.

Please suggest how to fix this?

---

<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:** [January 2, 2024, 1:37pm UTC](https://community.openpbs.org/t/license-check-and-fetch-the-3rd-party-license/3744/4 "2024-01-02T13:37:28Z")

</div>

Hi Ramesh,

For this scenario, implement server level resource ( with an assumption 10 licenses are reserved for the cluster usage and no user is checking out this license externally on to his workstation or laptop)

- qmgr : create resource liccheck type=long, flag=q
- qmgr : s s resources\_available.liccheck=10
- Add **liccheck** to the $PBS\_HOME/sched\_priv/sched\_config resources: line  
resources: “ncpus, mem, arch, host, vnode, aoe, eoe, **liccheck** ”
- kill -HUP 

**Now while requesting the license for the job**

qsub -l select=1:ncpus=10 **-l your\_server\_dyn\_res\_custom\_resource=10 -l licheck=10** job script

or if you are using directives in a script

#PBS -l select=1:ncpus=10  
**#PBS -l your\_server\_dyn\_res\_custom\_resource=10**  
**#PBS -l liccheck=10**

Hope this helps

---

<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:** [January 2, 2024, 1:54pm UTC](https://community.openpbs.org/t/license-check-and-fetch-the-3rd-party-license/3744/5 "2024-01-02T13:54:35Z")

</div>

> [@Ramesh](#):
>
> We want to know how to fetch the licenses or hold the licenses for particular queue jobs with users?

It is the application that is fetching the licenses, PBS Pro does not fetch or hold any licenses on behalf of the application. You might need to implement signal handlers within your script so that when the application recieves a suspend signal (man qsig), then it should release the licenses.

> [@Ramesh](#):
>
> But from our side all jobs goes to running state because scripts compile time take 5 minutes then only licenses will fetch. So its not going to queue state.

Correct, When the scheduler queries the license server for these jobs (via the server\_dyn\_scripts), the licenses are available (none of the jobs have checkedout the licenses) and hence jobs are let to run on the compute resources (one of the job gets the license and other jobs fails). PBS Pro does not know that the application takes 5 minutes to checkout the licenses, it is looking at the response of the license server with the available number of tokens.

---

<div class="post-metadata">

**Author:** ![Ramesh](https://avatars.discourse-cdn.com/v4/letter/r/d07c76/32.png) [@Ramesh](https://community.openpbs.org/u/Ramesh)\
**Post date:** [January 3, 2024, 8:01am UTC](https://community.openpbs.org/t/license-check-and-fetch-the-3rd-party-license/3744/6 "2024-01-03T08:01:35Z")

</div>

Hi Adarsh,  
Thank for the clarification,  
We have changed our scripts, Now our scripts pick 10 license for a job.  
Now we submitted multiple jobs but it has picked all 100 licenses for 10 jobs.

We are trying to execute job priority wise. Example  
We have submit jobA, jobB and jobC  
jobA should be run and other jobs should be in queue. Once jobA completed next jobB will be run and jobC same in q state.  
JobA → JobB → JobC

Please help me how to configure the logic.

---

<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:** [January 3, 2024, 10:03am UTC](https://community.openpbs.org/t/license-check-and-fetch-the-3rd-party-license/3744/7 "2024-01-03T10:03:50Z")

</div>

For example , the user are submitting these jobs (A, B, C) to a queue , say for example “workq”

#Limit the total number of running jobs for all users to 1 (this will help the licensing bit as well, for late checkout of licenses by application)  
qmgr -c "set queue workq max\_run = ‘[o:PBS\_ALL=1]’ "

#You can use the job sort formula to sort the jobs based on desired factors  
qmgr -c “set server job\_sort\_formula=ncpus \* walltime + queue\_priority”  
Note: Make sure by\_queue scheduler attritube is set to false in the $PBS\_HOME/sched\_priv/sched\_config and kill -HUP , so that all jobs belong one big bucket (otherwise, it will be queue by queue basis)

Please refer the PBS Professional Adminstrator guide and check for

- server and queue limits
- job sort formula
