cluster_pilots.py shows a traceback for a bad --k and leaves outputs when --truth is invalid

Open Beginner friendly
#232 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 3 days

@PRINCEKK122 is already working on this.

Since Nov 9, 2026.

  • #268 by @PRINCEKK122 — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
83/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
cli, testing

Research direction

Start with inference/cluster_pilots.py and the CLI tests in tests/test_cluster_pilots.py; compare invalid --k handling with the existing --truth-without---k usage error. Check that invalid truth input is rejected before any CSV is written. Done means bad input prints a one-line usage error with exit status 2 and failed runs leave no output files.

Written by the indexing model from the issue text.

Description

area:ml bug python

Describe the bug
Two behaviours of inference/cluster_pilots.py on the #225 branch. An out-of-range --k ends in a raw ValueError traceback. If --truth is invalid, the group and centre CSVs have already been written when the error is raised, so a failed run leaves half its outputs.

To Reproduce

  1. Run generate_synthetic_pilots.py, then compute_features.py on its output.
  2. python inference/cluster_pilots.py --k 1 prints a traceback ending ValueError: k must be 2 to 5 for 15 pilots, got 1.
  3. Repeat a row in inference/Data/synthetic_pilot_tiers.csv, then run python inference/cluster_pilots.py --k 3 --truth inference/Data/synthetic_pilot_tiers.csv. pilot_clusters.csv and group_centres.csv are written, then ValueError: Pilot(s) repeated in truth: P01.

Expected behavior
A one-line usage error and exit status 2 for a bad --k, as --truth without --k already gives. No output files when the run fails.

Screenshots
Not applicable.

Additional context
Fit and score first, then write; use parser.error for input errors. Needs CLI tests in tests/test_cluster_pilots.py.

Dominant language
Python
Stars
4
Forks
9
Avg merge
4d 17h
Merged PRs (30d)
7

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from oss-slu/PilotDataSynchronization

All issues in oss-slu/PilotDataSynchronization

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.