A job can be switched to a different queue after submission. This can be done even after the job has already started.
Below is an example program that switches a specified job to a new queue.
/******************************************************* LSBLIB -- Examples** simple bstop* The program switches a specified job to a new queue.******************************************************/#include <stdio.h>#include <lsf/lsbatch.h>#include <stdlib.h>int main(int argc, char **argv){/* check if the input is in the right format: "./simbstopJOBID QUEUENAME" */if (argc != 3) {printf("Usage: %s jobId new_queue\n", argv[1]);exit(-1);}/* initialize LSBLIB and get the configuration environment */if (lsb_init(argv[0]) <0) {lsb_perror("lsb_init");exit(-1);}/* switch the job to the new queue and check for success */if (lsb_switchjob(atoi(argv[1]), argv[2]) < 0) {lsb_perror("lsb_switchjob");exit(-1);}printf("Job %s is switched to new queue <%s>\n", argv[1], argv[2]);exit(0);}
On success, lsb_switchjob() returns 0. On failure, it returns -1 and sets lsberrno to indicate the error.