Skip to content
This repository was archived by the owner on Apr 24, 2023. It is now read-only.
This repository was archived by the owner on Apr 24, 2023. It is now read-only.

/unscheduled_jobs inaccurately reports "You have 1 other jobs ahead in the queue." #908

@dposada

Description

@dposada

Describe the bug
The /unscheduled_jobs endpoint inaccurately reports "You have 1 other jobs ahead in the queue.", despite the fact that the job it's referring to is already running.

To Reproduce
Steps to reproduce the behavior:

  1. Set your share to 1 cpu (not sure if this step is strictly necessary)
  2. Submit job A with priority=99, cpus=2, command=sleep 600 and wait for it to start running
  3. Submit job B with priority=100, cpus=2, command=sleep 600 and wait for it to start running
  4. Submit job C with priority=100, cpus=2, command=sleep 600
  5. Make a request to /unscheduled_jobs for job C
  6. Observe that it states that job B is "ahead in the queue" despite the fact that B is running

Expected behavior
It should not report that running jobs are "ahead in the queue".

Additional context

$ cs jobs --user root --running --waiting
Cluster    UUID                                  Name              Memory      CPUs    Priority  Attempts    Submitted      Command    Job Status
dev0       c9b7ef03-7df5-4c61-bebb-5f179890e14a  default_test_job  256 MB         2         100  0 / 1       a minute ago   sleep 600  Waiting
dev0       ed445d11-2629-4ba5-ac71-8b442b0e3997  default_test_job  256 MB         2         100  0 / 1       2 minutes ago  sleep 600  Running
dev0       68794df5-0dfb-459a-a32a-732f2877e1e7  default_test_job  256 MB         2          99  0 / 1       2 minutes ago  sleep 600  Running

$ curl localhost:12321/unscheduled_jobs?job=$uuid | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   379    0   379    0     0  20737      0 --:--:-- --:--:-- --:--:-- 21055
[
  {
    "uuid": "c9b7ef03-7df5-4c61-bebb-5f179890e14a",
    "reasons": [
      {
        "reason": "The job would cause you to exceed resource shares.",
        "data": {
          "cpus": {
            "limit": 1,
            "usage": 6
          }
        }
      },
      {
        "reason": "You have 1 other jobs ahead in the queue.",
        "data": {
          "jobs": [
            "ed445d11-2629-4ba5-ac71-8b442b0e3997"
          ]
        }
      },
      {
        "reason": "The job is now under investigation. Check back in a minute for more details!",
        "data": {}
      }
    ]
  }
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions