# Hook: Move job to Execution-Queue

**URL:** <https://community.openpbs.org/t/hook-move-job-to-execution-queue/560>\
**Category:** Users/Site Administrators\
**Created:** [May 29, 2017, 8:49am UTC](https://community.openpbs.org/t/hook-move-job-to-execution-queue/560 "2017-05-29T08:49:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Phhere](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.openpbs.org/phhere/32/25_2.png) [@Phhere](https://community.openpbs.org/u/Phhere)\
**Post date:** [May 29, 2017, 8:49am UTC](https://community.openpbs.org/t/hook-move-job-to-execution-queue/560/1 "2017-05-29T08:49:56Z")

</div>

Hello,  
we have a job which moves some jobs from our routing-queue to one of the execution queues based on some ressources and user limits from a third-party-system.

We have the problem that the job is moved to the queue by event=queuejob and then the user gets the information, that the job is rejected:  
qsub: Access to queue is denied

Then i look into the server log, i see that the error is 15022.  
The code looks like this (only parts): [https://gist.github.com/Phhere/1451349967e2272b4c338012e5508200](https://gist.github.com/Phhere/1451349967e2272b4c338012e5508200)

Do you have any idea how to fix this problem?  
The Queue UV2000 has this settings:  
create queue UV2000  
set queue UV2000 queue\_type = Execution  
set queue UV2000 Priority = 145  
set queue UV2000 max\_queued = [u:PBS\_GENERIC=1024]  
set queue UV2000 from\_route\_only = True  
set queue UV2000 default\_chunk.arch = uv2000  
set queue UV2000 default\_chunk.Qlist = uv2000  
set queue UV2000 enabled = True  
set queue UV2000 started = True

Kind Regards:  
Philipp Rehs  
University Düsseldorf, Germany

---

<div class="post-metadata">

**Author:** ![scc](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.openpbs.org/scc/32/234_2.png) [@scc](https://community.openpbs.org/u/scc)\
**Post date:** [May 30, 2017, 1:39pm UTC](https://community.openpbs.org/t/hook-move-job-to-execution-queue/560/2 "2017-05-30T13:39:16Z")

</div>

Hello Philipp, you are getting this rejection because of the “from\_route\_only” queue attribute. Setting the queue on a job directly from a queuejob hook does not qualify as a job being routed into the execution queue from a routing queue.

---

<div class="post-metadata">

**Author:** ![Phhere](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.openpbs.org/phhere/32/25_2.png) [@Phhere](https://community.openpbs.org/u/Phhere)\
**Post date:** [May 30, 2017, 1:46pm UTC](https://community.openpbs.org/t/hook-move-job-to-execution-queue/560/3 "2017-05-30T13:46:25Z")

</div>

I already suspected this and changed from\_route\_only to false.  
In which kind of hook would it work?

---

<div class="post-metadata">

**Author:** ![John\_Hearns](https://avatars.discourse-cdn.com/v4/letter/j/9e8a1a/32.png) [@John\_Hearns](https://community.openpbs.org/u/John_Hearns)\
**Post date:** [May 30, 2017, 2:09pm UTC](https://community.openpbs.org/t/hook-move-job-to-execution-queue/560/4 "2017-05-30T14:09:34Z")

</div>

“we have a job which moves some jobs from our routing-queue to one of the  
execution queues based on some ressources and user limits from a  
third-party-system”

Philipp, I think we need to find out what is the purpose of this moving job  
here.  
If the third-party system is a licensed application, and we are waiting on  
licenses, then you need to implement a license sensor.

If perhaps the job is waiting for another job to finish, ie there is a  
workflow and a series of jobs which are run to process the data,  
then maybe you should use a job dependency?

I hope I have not said somthing stupid.

---

<div class="post-metadata">

**Author:** ![Phhere](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.openpbs.org/phhere/32/25_2.png) [@Phhere](https://community.openpbs.org/u/Phhere)\
**Post date:** [May 30, 2017, 2:21pm UTC](https://community.openpbs.org/t/hook-move-job-to-execution-queue/560/5 "2017-05-30T14:21:09Z")

</div>

We want all jobs which meet one of the following conditions to get moved to the UV2000-Queue:

- more than 24 cores in one chunk
- more than 120gb ram in one chunk
- have arch=uv2000 as ressource

If you have an idea how we can configure this, it would be great if you share your idea

---

<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:** [September 7, 2017, 11:48am UTC](https://community.openpbs.org/t/hook-move-job-to-execution-queue/560/6 "2017-09-07T11:48:42Z")

</div>

Philipp,

1. You can use a wrapper script or job submission script which would take the input from the users and ( memory, cpus, arch, input file name, walltime etc ) and does the qsub at the end to specific queues ( here in this case it will be UV2000-Queue )

2. server periodic hook on a queue which has not started , which calls a scripts which these conditions and qmoves the jobs that match [No 1 would be neat]

---

<div class="post-metadata">

**Author:** ![agurban](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.openpbs.org/agurban/32/67_2.png) [@agurban](https://community.openpbs.org/u/agurban)\
**Post date:** [September 7, 2017, 5:16pm UTC](https://community.openpbs.org/t/hook-move-job-to-execution-queue/560/7 "2017-09-07T17:16:04Z")

</div>

Hi Philipp,

Section 4.8.40, “Routing Jobs”, on page 185 in the 14.2.1 Admin Guide,  
might be helpful. It presents methods for collecting and routing jobs.
