Skip to content

fix(examples): exit non-zero on count_tasks.sh error paths#298

Merged
kristinapathak merged 1 commit into
NVIDIA:mainfrom
mesutoezdil:mesutoezdil/fix/count-tasks-exit-code
Jul 21, 2026
Merged

fix(examples): exit non-zero on count_tasks.sh error paths#298
kristinapathak merged 1 commit into
NVIDIA:mainfrom
mesutoezdil:mesutoezdil/fix/count-tasks-exit-code

Conversation

@mesutoezdil

@mesutoezdil mesutoezdil commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

TL;DR

Both error paths used a bare exit, so the script returned 0 when the org id was missing or ngc was absent. Now exit 1, matching clear_all_tasks.sh, plus set -euo pipefail and ORG_ID=${1:-} per the examples shell style. Both failure paths verified to exit 1; example script with no test harness.

Issues

Closes #297

@mesutoezdil
mesutoezdil requested a review from a team as a code owner July 21, 2026 09:16
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The task-counting shell script now uses stricter Bash error handling, defaults a missing ORG_ID to empty, and exits with status 1 when ORG_ID or the ngc CLI is unavailable.

Changes

Task-counting error handling

Layer / File(s) Summary
Explicit error exits and Bash safety
examples/load-tests/tasks/count_tasks.sh
The script enables -euo pipefail, safely handles a missing ORG_ID, and uses exit 1 for both error paths.

Estimated code review effort: 1 (Trivial) | ~2 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The script now exits 1 for both missing-org-id and missing-ngc error paths, matching issue #297.
Out of Scope Changes check ✅ Passed The added Bash safety setting is still related to the same script, and no unrelated changes appear.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: making count_tasks.sh error paths exit non-zero.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
examples/load-tests/tasks/count_tasks.sh (1)

16-19: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Enable strict shell mode safely. Use set -euo pipefail and read the org id with ORG_ID=${1:-} so missing arguments still hit the existing org id is required check instead of aborting on $1.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/load-tests/tasks/count_tasks.sh` around lines 16 - 19, Update the
shell script’s strict-mode setup to use set -euo pipefail, and change the
positional argument assignment to default missing $1 to an empty value via
ORG_ID=${1:-}. Preserve the existing org-id-required validation so omitted
arguments reach that check instead of causing an unset-parameter failure.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@examples/load-tests/tasks/count_tasks.sh`:
- Around line 22-31: Add regression tests for count_tasks.sh covering invocation
without ORG_ID and invocation when ngc is unavailable, asserting exit status 1
for both failure paths. Use the repository’s native shell-test framework and
ensure the ngc test isolates or mocks command -v behavior; run the native test
runner before committing, or document the reason for omission in the pull
request description.

---

Outside diff comments:
In `@examples/load-tests/tasks/count_tasks.sh`:
- Around line 16-19: Update the shell script’s strict-mode setup to use set -euo
pipefail, and change the positional argument assignment to default missing $1 to
an empty value via ORG_ID=${1:-}. Preserve the existing org-id-required
validation so omitted arguments reach that check instead of causing an
unset-parameter failure.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 427fad65-a4c6-4b2a-9e75-899d27dbd4f9

📥 Commits

Reviewing files that changed from the base of the PR and between 5ef95ed and 791cfc3.

📒 Files selected for processing (1)
  • examples/load-tests/tasks/count_tasks.sh

Comment thread examples/load-tests/tasks/count_tasks.sh
Both error paths used a bare exit, which returns the status of the
preceding echo, so the script exited 0 when the org id was missing
or the ngc CLI was absent. Use exit 1 like clear_all_tasks.sh does.
Also enable set -euo pipefail per the examples shell style and read
the org id with a default so the missing-argument case still reaches
the existing check.

Closes NVIDIA#297

Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
@mesutoezdil
mesutoezdil force-pushed the mesutoezdil/fix/count-tasks-exit-code branch from 791cfc3 to 6247fac Compare July 21, 2026 12:38
@kristinapathak
kristinapathak added this pull request to the merge queue Jul 21, 2026
Merged via the queue into NVIDIA:main with commit 8ec64c5 Jul 21, 2026
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

load-tests: count_tasks.sh exits 0 on error paths

2 participants