Skip to content

ui: NMD-872-System jobs on node-pools scaled to 0 show up in UI as failed#27949

Open
navyadas-dev wants to merge 2 commits into
mainfrom
NMD-872
Open

ui: NMD-872-System jobs on node-pools scaled to 0 show up in UI as failed#27949
navyadas-dev wants to merge 2 commits into
mainfrom
NMD-872

Conversation

@navyadas-dev

@navyadas-dev navyadas-dev commented May 12, 2026

Copy link
Copy Markdown
Collaborator

Description

System jobs with no eligible nodes (e.g., when all nodes in a node pool are scaled to zero, or when constraints don't match any nodes) incorrectly display as "Failed" in both the jobs list and job details page. This is misleading because the job hasn't actually failed - it simply has no nodes to run on.

Reproduction Steps

I have used constraints instead of node pools as Node Pools Governance is an enterprise feature.

  1. Start Nomad in dev mode:
./bin/nomad agent -dev
  1. Start the UI.
USE_MIRAGE=false ember server --proxy http://127.0.0.1:4646
  1. Submit the job:
nomad job run system-job-no-nodes.nomad.hcl
  1. Use the following job file:
# System job for testing NMD-872 (OSS-compatible version)
# This job uses constraints that no nodes will match, simulating an empty node pool

job "test-system-job-no-nodes" {
  # System jobs run on every eligible node
  type = "system"

  # Constraint that will never match any node
  # This simulates having a node pool with 0 nodes
  constraint {
    attribute = "${node.class}"
    value     = "nonexistent-class-for-testing-nmd-872"
  }

  group "monitoring" {

    restart {
      attempts = 3
      delay    = "15s"
      interval = "5m"
      mode     = "delay"
    }

    task "agent" {
      driver = "raw_exec"

      config {
        command = "bash"

        args = [
          "-c",
          "echo 'System job running'; sleep 3600"
        ]
      }

      resources {
        cpu    = 100
        memory = 128
      }

      env {
        JOB_TYPE  = "system"
        TEST_CASE = "NMD-872"
      }
    }
  }
}

Changes:

ui/app/models/job.js (Jobs List Status)

  • Added logic to check for failure signals (failed/lost/unplaced allocations) when totalAllocs === 0
  • Fixed fallback condition to only return "Failed" when totalAllocs > 0 AND all allocations have failed
  • Added fallback to "Scaled Down" for jobs with 0 allocations and no failures

ui/app/components/job-status/panel/steady.js (Job Details Page Status)

  • Simplified early return for service jobs with 0 allocations
  • Fixed fallback condition to prevent 0 === 0 bug
  • Added fallback to "Scaled Down" for edge cases

ui/tests/acceptance/jobs-list-test.js (Test Update)

  • Updated test expectation for ancient-system-job from "Failed" to "Scaled Down"

Testing & Reproduction steps

Before:
System job with no eligible nodes: "Failed" (red)

NMD-872-Before.mov

After:
System job with no eligible nodes: "Scaled Down" (neutral/gray)

NMD-872-After.mov

Job List view
Screenshot 2026-05-12 at 1 56 51 PM

Job details page
Screenshot 2026-05-12 at 1 57 41 PM

Links

https://hashicorp.atlassian.net/browse/NMD-872

Contributor Checklist

  • Changelog Entry If this PR changes user-facing behavior, please generate and add a
    changelog entry using the make cl command.
  • Testing Please add tests to cover any new functionality or to demonstrate bug fixes and
    ensure regressions will be caught.
  • Documentation If the change impacts user-facing functionality such as the CLI, API, UI,
    and job configuration, please update the Nomad product documentation, which is stored in the
    web-unified-docs repo. Refer to the web-unified-docs contributor guide for docs guidelines.
    Please also consider whether the change requires notes within the upgrade
    guide
    . If you would like help with the docs, tag the nomad-docs team in this PR.

Reviewer Checklist

  • Backport Labels Please add the correct backport labels as described by the internal
    backporting document.
  • Commit Type Ensure the correct merge method is selected which should be "squash and merge"
    in the majority of situations. The main exceptions are long-lived feature branches or merges where
    history should be preserved.
  • Enterprise PRs If this is an enterprise only PR, please add any required changelog entry
    within the public repository.
  • If a change needs to be reverted, we will roll out an update to the code within 7 days.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

@navyadas-dev navyadas-dev marked this pull request as ready for review May 12, 2026 08:57
@navyadas-dev navyadas-dev requested review from a team as code owners May 12, 2026 08:57
@navyadas-dev navyadas-dev changed the title f-ui-NMD-872-System jobs on node-pools scaled to 0 show-up in UI as failed ui: NMD-872-System jobs on node-pools scaled to 0 show up in UI as failed May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants