Skip to content

feature: provide a way to view all pending or running provisioner jobs #15084

Closed
7 of 7 issues completed
Closed

Description

@johnstcn

Motivation

Relates to #15047

There is currently no way to get a top-level view of all pending or running provisioner jobs.
This is useful for administrators troubleshooting issues with hung or pending jobs in combination with tagged provisioner daemons. Having this available would have been helpful in surfacing the root cause of the linked issue.

Proposed Solution

  1. Add an API endpoint that lists all provisioner jobs. We should allow filtering at minimum by organization, status (pending, running, completed, failed) and time (created_at). In the case of running, completed, or failed jobs, also include information on the provisioners that handled the job.

Required permissions: read all templates in org, read all workspaces in org.

  1. Add a CLI command that queries the above endpoint. We may also potentially expose a command to list all registered provisioners.

  2. Add a UI endpoint to list all provisioner jobs. We should have enough contextual information available to link to associated workspace builds and template versions.

Sub-issues

Sub-issues

7 of 7 Issues completed
Loading 7 sub-issues

Activity

  1. added
    api
    need-backend
    on Oct 15, 2024
  2. bpmct commented on Oct 18, 2024

    @bpmct
    Member
  3. added
    design needed
    on Oct 21, 2024
  4. johnstcn commented on Oct 23, 2024

    @johnstcn
    MemberAuthor

    Hey @chrifro , would you have some bandwidth for a quick UI mockup for part 3 of the above? It doesn't have to be anything overly fancy; even a simple table will probably suffice.

  5. chrifro commented on Oct 23, 2024

    @chrifro
    Collaborator

    Hey @chrifro , would you have some bandwidth for a quick UI mockup for part 3 of the above? It doesn't have to be anything overly fancy; even a simple table will probably suffice.

    Sure, I can help @johnstcn. But I need a bit more context first. I'm not fully familiar with the provisioner setup yet.

    • Where would you like to see the table of the provisioner jobs? Right now, they exist under organizations [1] but you'd like to view all of them in a central place, right? Would a new tab under "deployment" make sense for that?
    • Any other information that should be shown in the table besides: "filtering at minimum by organization, status (pending, running, completed, failed) and time (created_at). In the case of running, completed, or failed jobs, also include information on the provisioners that handled the job. Workspace builds and template versions." That's all?

    screenshot of the current provisioner information on organization level
    Image

  6. johnstcn commented on Oct 23, 2024

    @johnstcn
    MemberAuthor

    you'd like to view all of them in a central place, right? Would a new tab under "deployment" make sense for that?

    That makes sense!

    Any other information that should be shown in the table

    I think that covers it for now. But it actually might make sense to defer this until we have a corresponding CLI command defined, as that would probably inform us of any information I've missed. What do you think?

  7. chrifro commented on Oct 23, 2024

    @chrifro
    Collaborator

    Perfect, then I will draft something based on that and we can always iterate on it and adjust the shown information.

    Does it work if I have something by end of week/early next week?

  8. johnstcn commented on Oct 23, 2024

    @johnstcn
    MemberAuthor

    Does it work if I have something by end of week/early next week?

    That sounds fine to me!

  9. chrifro commented on Oct 25, 2024

    @chrifro
    Collaborator

    Here is a first draft. Note: the design is not final yet. I'd like to align on the information structure and direction first. Is this what you had in mind? Are there any information missing? Feel free to comment directly in Figma.

    include information on the provisioners that handled the job

    Could you provide an example? What kind of information would you like to see here?

    Image

  10. mafredri commented on Oct 28, 2024

    @mafredri
    Member

    @johnstcn I've drafted up an example of the outputs for the CLI commands, do these match the expected behavior and is there any missing/excess data?

    ❯ coder provisioner jobs list
    CREATED AT            JOB                                   ORGANIZATION  STATUS     TYPE                     QUEUE  COMPLETED BY PROVISIONER            TAGS       AVAILABLE PROVISIONERS
    2024-10-19T16:22:39Z  9739dfd4-d69e-4369-9eed-f6e8a0c5cb57  Coder         completed  workspace_build                 coder-provisioner-789964695d-48cw6             []
    2024-10-24T16:27:56Z  6976d3c0-64b1-4ace-8c5f-6bb620fae1ee  Coder         failed     workspace_build                 coder-provisioner-789964695d-k285t  [foo=bar]  []
    2024-10-26T16:28:20Z  b1547e9d-502b-47a3-ba0b-b05e56825b36  Coder         pending    template_version_import                                             [baz=qux]  []
    2024-10-26T16:29:26Z  d0eb5f9f-81c7-4042-896e-055d095ae9cc  Coder         pending    template_version_import  1/1                                                   [coder-provisioner-789964695d-48cw6,coder-provisioner-789964695d-k285t]

    Note: I considered adding template version/workspace name, but it could be looked up by job ID instead.

    ❯ coder provisioner list
    NAME                                ORGANIZATION  STATUS        CURRENT JOB                           PREVIOUS JOB                          PREVIOUS_JOB_STATUS  JOBS LAST 24H  TYPE      CREATED AT            LAST SEEN             VERSION     TAGS
    coder-provisioner-789964695d-48cw6  Coder         connected     d0eb5f9f-81c7-4042-896e-055d095ae9cc  9739dfd4-d69e-4369-9eed-f6e8a0c5cb57  completed            2              psk       2024-10-19T16:22:39Z  2024-10-26T16:29:26Z  up to date  []
    coder-provisioner-789964695d-k285t  Coder         connected                                           6976d3c0-64b1-4ace-8c5f-6bb620fae1ee  failed               2              psk       2024-10-26T16:28:20Z  2024-10-26T16:29:26Z  up to date  [foo=bar]
    coder-provisioner-789964695d-r822d  Coder         disconnected                                        66f8290b-2ac0-4fd4-aa16-c926d8b8b61c  completed            0              psk       2024-10-26T16:28:20Z  2024-10-26T16:29:26Z  up to date  [baz=qux]

    The outputs are fairly wide, I'd love to reduce it, but I felt like all of this information is useful in trying to find potential issues.

  11. johnstcn commented on Oct 28, 2024

    @johnstcn
    MemberAuthor

    @mafredri I think we can show basic information by default but provide additional optional columns:

    • For provisioner jobs list, we could move "completed by provisioner" and "available provisioners" to optional columns not shown by default.
    • Similarly, for provisioner list, we could probably make "previous job" and "previous job status" both optional columns. Maybe also "jobs last 24h", but dealer's choice.

    Apart from that, the basic gist of the output looks good to me! 👍

  12. matifali commented on Oct 28, 2024

    @matifali
    Contributor

    Seeing the number of jobs in the queue for each provisioner will be nice too.

  13. mafredri commented on Oct 28, 2024

    @mafredri
    Member
    • For provisioner jobs list, we could move "completed by provisioner" and "available provisioners" to optional columns not shown by default.

    I think showing available provisioners could be a good default since it's what can tell you immediately if there's a problem or not. But maybe we just show a number, available provisioners = 2 instead of the list? Then it could probably be default enabled. An alternative way to show this could be to show ? / 0/0 / [loading symbol] in the queue column, but not a fan of the inference requirement.

    • Similarly, for provisioner list, we could probably make "previous job" and "previous job status" both optional columns. Maybe also "jobs last 24h", but dealer's choice.

    I agree, maybe those columns are not even needed. We could add another column instead: last job = 3m ago, an increasing number here may help suggest something could be wrong.


    Seeing a list of a number of jobs in the queue will be nice to have.

    @matifali could you expand on what you're thinking of? Is it different from coder provisioner jobs list filtered on pending? Are you thinking CLI or Web UI? Or something else?

  14. 32 remaining items

  15. johnstcn commented on Jul 7, 2025

    @johnstcn
    MemberAuthor

    Fixed by #16867 and #16030

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

apineed-backend

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions