• Icon: Improvement Improvement
    • Resolution: Not A Defect
    • Icon: Blocker Blocker
    • other
    • None
    • Platform: PC, OS: Windows 2000

      If you have a large number of jobs queued up waiting for an executor, it would
      be helpful if there were a means of moving a job to the front of the queue.
      Perhaps a button next to the "cancel" button with an up arrow.

      This button should only appear if there are more jobs than executors, and only
      for users with either the Admin privilege, or the Job|Build privilege.

          [JENKINS-1878] Ability to move job to top of queue

          frizbog added a comment -

          I'm thinking that adding a "priority" attribute to
          hudson.model.Queue.WaitingItem would be a good way to deal with this. The
          comparator could look at priority before looking at timestamp. Priority could
          be "Held", "Low", "Normal", and "High" and default to "Normal". Various
          functions could increase or decrease the priority of a job.

          frizbog added a comment - I'm thinking that adding a "priority" attribute to hudson.model.Queue.WaitingItem would be a good way to deal with this. The comparator could look at priority before looking at timestamp. Priority could be "Held", "Low", "Normal", and "High" and default to "Normal". Various functions could increase or decrease the priority of a job.

          frizbog added a comment -

          I'm going to try doing this.

          frizbog added a comment - I'm going to try doing this.

          If you do this, I'd encourage you to use AJAX D&D reordering, as opposed to
          additional button.

          Given the relative unimportance of the feature (sorry), it would be better not
          to clutter the UI.

          If you have a large number of queued up jobs, you really should just add more
          slaves.

          Kohsuke Kawaguchi added a comment - If you do this, I'd encourage you to use AJAX D&D reordering, as opposed to additional button. Given the relative unimportance of the feature (sorry), it would be better not to clutter the UI. If you have a large number of queued up jobs, you really should just add more slaves.

          frizbog added a comment -

          Based on the recent discussion of swappable queue implementations, etc., I'm
          going to put this back to be worked on later in a more coordinated effort.

          frizbog added a comment - Based on the recent discussion of swappable queue implementations, etc., I'm going to put this back to be worked on later in a more coordinated effort.

          Carl Quinn added a comment -

          Throwing in my $.02: We have a case where most of the time we have plenty of executors, but every few days we integrate changes to the build tools in the source repo, usually after hours, and the result is that nearly everything rebuilds. So this takes a couple of hours, and occasionally someone needs to get a build triggered and through the system when this is happening. Being able to expedite a particular build would be handy.

          I think the priority plugin has the potential to fix this: http://issues.jenkins-ci.org/browse/JENKINS-8275 , but I thought I'd chime in here too.

          Carl Quinn added a comment - Throwing in my $.02: We have a case where most of the time we have plenty of executors, but every few days we integrate changes to the build tools in the source repo, usually after hours, and the result is that nearly everything rebuilds. So this takes a couple of hours, and occasionally someone needs to get a build triggered and through the system when this is happening. Being able to expedite a particular build would be handy. I think the priority plugin has the potential to fix this: http://issues.jenkins-ci.org/browse/JENKINS-8275 , but I thought I'd chime in here too.

          Martin Ba added a comment -

          I'll put a comment here instead of creating a new issue or renaming this one right away, but shouldn't this really read: "Allow for rearranging / editing the build queue"? (Note: I've not found any other current issue than this one here.)

          That is – and I think this is an extremely "natural" requirement for people who's build queue is full regularly – what we need is for the build queue to be "editable": Move waiting jobs around arbitrarily. (And I think the Priority Sorter Plugin should only determine the inital sort order.)

          Martin Ba added a comment - I'll put a comment here instead of creating a new issue or renaming this one right away, but shouldn't this really read: "Allow for rearranging / editing the build queue"? (Note: I've not found any other current issue than this one here.) That is – and I think this is an extremely "natural" requirement for people who's build queue is full regularly – what we need is for the build queue to be "editable": Move waiting jobs around arbitrarily. (And I think the Priority Sorter Plugin should only determine the inital sort order.)

          This feature would be very helpful for our scenario. It is really annoying if one has to either wait for other projects to be build first or need to stop them and thus breaking the usual code checking functionality of the build server.

          There are some situations like developing/debugging the build of the server itself or using the artifacts of the project as an urgent release where this feature would be really nice.

          Adding more slaves is reducing the problem but not really solving (at least for numSlaves < numProjects).

          Franz Hirschbeck added a comment - This feature would be very helpful for our scenario. It is really annoying if one has to either wait for other projects to be build first or need to stop them and thus breaking the usual code checking functionality of the build server. There are some situations like developing/debugging the build of the server itself or using the artifacts of the project as an urgent release where this feature would be really nice. Adding more slaves is reducing the problem but not really solving (at least for numSlaves < numProjects).

          evernat added a comment -

          I think that this feature request is now in the Accelerated Build Now plugin, which is available in your Jenkins update center.

          The plugin's page is at:
          https://wiki.jenkins-ci.org/display/JENKINS/Accelerated+Build+Now+Plugin

          evernat added a comment - I think that this feature request is now in the Accelerated Build Now plugin, which is available in your Jenkins update center. The plugin's page is at: https://wiki.jenkins-ci.org/display/JENKINS/Accelerated+Build+Now+Plugin

          The Accelerated Build Now plugin doesn't fully address the problem. It can't help you if you want to increase the priority of a job that was queued noninteractively (and can't easily be started manually). Usually when we want to have a job jump to the head of the queue it's a job that was queued by the Gerrit Trigger Plugin, and there's no way to trigger one of those with Accelerated Build Now. Just adding more slaves would be great, but each of the slaves in this case represents a very expensive set of test hardware. Being able to bump an existing job to the head of the queue is still a missing and needed feature.

          Andrew Lawrence added a comment - The Accelerated Build Now plugin doesn't fully address the problem. It can't help you if you want to increase the priority of a job that was queued noninteractively (and can't easily be started manually). Usually when we want to have a job jump to the head of the queue it's a job that was queued by the Gerrit Trigger Plugin, and there's no way to trigger one of those with Accelerated Build Now. Just adding more slaves would be great, but each of the slaves in this case represents a very expensive set of test hardware. Being able to bump an existing job to the head of the queue is still a missing and needed feature.

          Jan Tymiński added a comment -

          As Andrew says, there's the same issue for me, where I have tons of jobs started automatically, they cannot be started manually in current setup (in terms of manual start from Jenkins UI - I can easily trigger the autostart mechanism to add particular job to the queue) so I need to move to the top of the queue the job, that was already added automatically - I just need this particular job to happen before any other job.

          Jan Tymiński added a comment - As Andrew says, there's the same issue for me, where I have tons of jobs started automatically, they cannot be started manually in current setup (in terms of manual start from Jenkins UI - I can easily trigger the autostart mechanism to add particular job to the queue) so I need to move to the top of the queue the job, that was already added automatically - I just need this particular job to happen before any other job.

          Chris Engel added a comment -

          This is a feature we would really like to have as well.  Similar to Andrew our slave nodes represent test hardware so we can't just add more.  Beyond that a run on these machines can take over an hour at times.   We use the Priority Sorter Plugin to help sort the queue initially based on a couple priority groups.  But there are often times when we need to have a high priority build moved to the top of the queue and this feature should allow for that.

          Chris Engel added a comment - This is a feature we would really like to have as well.  Similar to Andrew our slave nodes represent test hardware so we can't just add more.  Beyond that a run on these machines can take over an hour at times.   We use the Priority Sorter Plugin to help sort the queue initially based on a couple priority groups.  But there are often times when we need to have a high priority build moved to the top of the queue and this feature should allow for that.

          Kayvan Sylvan added a comment -

          Very important for us as well. I don't believe the Accelerated Build Now plugin works.

          Kayvan Sylvan added a comment - Very important for us as well. I don't believe the Accelerated Build Now plugin works.

          carlos novo added a comment -

          +1

          carlos novo added a comment - +1

          Anas Javaid added a comment -

          +1

          Anas Javaid added a comment - +1

          Mark Han added a comment -

          Is the only way to get around this to cancel all queued items? How is this not a feature?

          Mark Han added a comment - Is the only way to get around this to cancel all queued items? How is this not a feature?

          +1

          This is rare use case for us, but when it happens it is usually in response to a developer begging me to help them meet a deadline with testing & delivering a fix, but finding the job with their changes behind a very long queue. Once in a while we get a wave of triggered jobs when an underlying database schema is updated and that unlucky developer may be looking at unacceptable delays. 

          My work around is to hijack a node, set it to only run jobs with that node as a label, then modify they job to use the label for that node. That is imperfect and annoying, but usually good enough. We would love the ability to be able to right click the triggered build and select "Move to front of queue".

          John McCullough added a comment - +1 This is rare use case for us, but when it happens it is usually in response to a developer begging me to help them meet a deadline with testing & delivering a fix, but finding the job with their changes behind a very long queue. Once in a while we get a wave of triggered jobs when an underlying database schema is updated and that unlucky developer may be looking at unacceptable delays.  My work around is to hijack a node, set it to only run jobs with that node as a label, then modify they job to use the label for that node. That is imperfect and annoying, but usually good enough. We would love the ability to be able to right click the triggered build and select "Move to front of queue".

          Ronny Borchert added a comment - - edited

          The plugin is not working right after installation. It is needed a restart of jenkins that the menu entry is appearing.

          Ronny Borchert added a comment - - edited The plugin is not working right after installation. It is needed a restart of jenkins that the menu entry is appearing.

          Luis Ehlen added a comment -

          Looks like this plugin does the trick, has anybody tested it?
          https://plugins.jenkins.io/simple-queue

          Luis Ehlen added a comment - Looks like this plugin does the trick, has anybody tested it? https://plugins.jenkins.io/simple-queue

          Mark Sinclair added a comment -

          I've done some light testing of the simple-queue plugin and it seems to work well.  Thanks Jaroslav!

          Mark Sinclair added a comment - I've done some light testing of the simple-queue plugin and it seems to work well.  Thanks Jaroslav!

          Søren Friis added a comment - - edited

          lehlen, thanks a lot for recommending simple-queue. We have been looking for something like this for a long time.
          And big thanks to otradovec for writing the plugin!
          We have started using it, and it seems to work as intended. Very useful when e.g. a release-job needs to jump the queue.
          otradovec I have a minor bug-report for the plugin. How do I report that? There is no "issues" tab on the plugin's Github.

          Edit: I found the bug-section for this particular plugin and reported an issue here in Jira.

           

          Søren Friis added a comment - - edited lehlen , thanks a lot for recommending simple-queue. We have been looking for something like this for a long time. And big thanks to otradovec for writing the plugin! We have started using it, and it seems to work as intended. Very useful when e.g. a release-job needs to jump the queue. otradovec I have a minor bug-report for the plugin. How do I report that? There is no "issues" tab on the plugin's Github. Edit: I found the bug-section for this particular plugin and reported an issue here in Jira.  

          With the Simple Queue plugin, this issue can probably be resolved.

          Brian J Murrell added a comment - With the Simple Queue plugin, this issue can probably be resolved.

          Luis Ehlen added a comment -

          I finally ended using this other plugin: https://plugins.jenkins.io/PrioritySorter/
          you can set priorities on Jobs, but you have to do it before launch the builds.

          Luis Ehlen added a comment - I finally ended using this other plugin: https://plugins.jenkins.io/PrioritySorter/ you can set priorities on Jobs, but you have to do it before launch the builds.

          Simple queue plugin is intended to work along with Priority Sorter. If the priority of jobs remains stable, than Priority Sorter is solution, but if it changes than simple queue aims to be more flexible. There are also some other plugins that can be used in some corner cases like - Dependency queue, Accelerated build now, ... I am not sure how are they compatible, but simple q. should be compatible with priority sorter.

          Jaroslav Otradovec added a comment - Simple queue plugin is intended to work along with Priority Sorter. If the priority of jobs remains stable, than Priority Sorter is solution, but if it changes than simple queue aims to be more flexible. There are also some other plugins that can be used in some corner cases like - Dependency queue, Accelerated build now, ... I am not sure how are they compatible, but simple q. should be compatible with priority sorter.

          sorenfriis

          Thank you!

          You are right that the issue feature is not enabled in simplequeue github repo, is there any benefit in that when we have Jira?

          Jaroslav Otradovec added a comment - sorenfriis Thank you! You are right that the issue feature is not enabled in simplequeue github repo, is there any benefit in that when we have Jira?

          Recommended plugins:

          Simple queue

          Priority sorter = Advanced queue

          Dependency queue

          Jaroslav Otradovec added a comment - Recommended plugins: Simple queue Priority sorter = Advanced queue Dependency queue

          li added a comment -

          how to move to top queue in scripted pipeline ?

          li added a comment - how to move to top queue in scripted pipeline ?

          frizbog As far as I understand scripted pipeline is just the normal way how are builds/queue items created - I don't know about any plugin that would enable changing queue order from pipeline (Do you know about any?), but you can change it when it is in the queue. If some kind of build is always higher priority I would recommend using https://plugins.jenkins.io/PrioritySorter/#documentation The latest version shoul be compatible with pipeline plugin.

          Jaroslav Otradovec added a comment - frizbog As far as I understand scripted pipeline is just the normal way how are builds/queue items created - I don't know about any plugin that would enable changing queue order from pipeline (Do you know about any?), but you can change it when it is in the queue. If some kind of build is always higher priority I would recommend using https://plugins.jenkins.io/PrioritySorter/#documentation The latest version shoul be compatible with pipeline plugin.

          li added a comment -

          https://issues.jenkins.io/secure/ViewProfile.jspa?name=otradovec otradovec Thanks. If possible to move via POST such as the following? How can i fetch the itermId?

          li added a comment - https://issues.jenkins.io/secure/ViewProfile.jspa?name=otradovec otradovec  Thanks. If possible to move via POST such as the following? How can i fetch the itermId?

          limengfei It is possible to get the id under something like : http://0.0.0.0:8080/job/<job_name_here>/api/json      -> queueItem:  -> id:

          Currently there is no clear feedback when you use the same api as UI, regarding if it passed or not. Maybe checking the order in the queue?

          There is currently an issue to make it better: https://issues.jenkins.io/browse/JENKINS-66928

          Jaroslav Otradovec added a comment - limengfei It is possible to get the id under something like : http://0.0.0.0:8080/job/ <job_name_here>/api/json      -> queueItem:  -> id: Currently there is no clear feedback when you use the same api as UI, regarding if it passed or not. Maybe checking the order in the queue? There is currently an issue to make it better: https://issues.jenkins.io/browse/JENKINS-66928

            otradovec Jaroslav Otradovec
            frizbog frizbog
            Votes:
            74 Vote for this issue
            Watchers:
            72 Start watching this issue

              Created:
              Updated:
              Resolved: