Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-8405

Optionally pause/cancel lower priority jobs in favor of higher priority jobs in the queue

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Minor Minor
    • prioritysorter-plugin
    • None

      Currently the priority sorter plugin does a great job of sorting jobs in the queue. However, if a low priority job is started, and then later a higher priority job enters the queue, the higher priority job still has to wait for the lower priority one.

      Is there a chance the plugin could be extended to do something in that situation?

      One option would be to cancel the low prio job (I guess that is technically possible, since it is possible manually). There could be an option to let the low prio job if its estimated remaining time is less than N minutes. This would still guarantee high prio jobs do not wait long.

      Another option would be to pause the low prio job instead of cancelling it. I don't know if that's harder technically (I'm thinking about kill -CONT on unix, don't know about other platforms). Another thing to consider is that the job would then stay in memory; however it could still be swapped out, and that might be cheaper than to restart the job later.

      Any comments or ideas welcome.

          [JENKINS-8405] Optionally pause/cancel lower priority jobs in favor of higher priority jobs in the queue

          bklarson added a comment -

          I'd love to be able to do this. I don't think cancelling a current build is a good option - if that is needed, it can be done by hand. It would be great if we could pause a lower-priority job though and free up the build executor. If and when JENKINS-4683 is fixed, I'll tie in the priority sorter.

          bklarson added a comment - I'd love to be able to do this. I don't think cancelling a current build is a good option - if that is needed, it can be done by hand. It would be great if we could pause a lower-priority job though and free up the build executor. If and when JENKINS-4683 is fixed, I'll tie in the priority sorter.

          bklarson added a comment -

          Changing to Minor to match JENKINS-4683

          bklarson added a comment - Changing to Minor to match JENKINS-4683

          Joey Surls added a comment -

          It'd be neat if you could drag/drop the reording in the queue using something like scriptaculous or some ajax library.

          Joey Surls added a comment - It'd be neat if you could drag/drop the reording in the queue using something like scriptaculous or some ajax library.

          Paul Fee added a comment -

          Cancelling the existing low priority job may not be nice, but it should be the easiest to implement as the capability to manually cancel a job already exists.

          The prospect of pausing, then resuming a low priority job looks nice, however there may be reasons why this can't happen which are beyond the control of Jenkins. For example the job may need exclusive use of a build slave, using hard coded paths that would collide if two jobs run concurrently. Even if one job is paused, the new high priority job risks being contaminated by the paused job or alternatively the low priority job may be upset by changes to its environment caused by the high priority job.

          Can we have the ability to cancel the low priority job?

          When pausing JENKINS-4683 becomes available, then make that an option as well. Let's give the user the choice rather than delaying a solution to this bug to wait for pause functionality.

          Paul Fee added a comment - Cancelling the existing low priority job may not be nice, but it should be the easiest to implement as the capability to manually cancel a job already exists. The prospect of pausing, then resuming a low priority job looks nice, however there may be reasons why this can't happen which are beyond the control of Jenkins. For example the job may need exclusive use of a build slave, using hard coded paths that would collide if two jobs run concurrently. Even if one job is paused, the new high priority job risks being contaminated by the paused job or alternatively the low priority job may be upset by changes to its environment caused by the high priority job. Can we have the ability to cancel the low priority job? When pausing JENKINS-4683 becomes available, then make that an option as well. Let's give the user the choice rather than delaying a solution to this bug to wait for pause functionality.

          D R added a comment -

          +1 for the ability to automatically kill low priority jobs once higher priority jobs come in. The low priority jobs I have are really low priority, and killing them almost certainly won't affect future builds. So, being able to just kill -9 them is a really great solution to my problem.

          Thanks for your great contributions! FWIW, I'm an active maintainer of the ACL2 Community Books and also believe in the open source model.

          D R added a comment - +1 for the ability to automatically kill low priority jobs once higher priority jobs come in. The low priority jobs I have are really low priority, and killing them almost certainly won't affect future builds. So, being able to just kill -9 them is a really great solution to my problem. Thanks for your great contributions! FWIW, I'm an active maintainer of the ACL2 Community Books and also believe in the open source model.

            bklarson bklarson
            dbr dbr
            Votes:
            6 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated: