feat(test-harness): add --keep-outputs flag and refactor Runner to Options struct#2942
feat(test-harness): add --keep-outputs flag and refactor Runner to Options struct#2942markphelps merged 4 commits intomainfrom
Conversation
…e Options struct Adds a --keep-outputs flag that preserves the work directory (and its prediction output files like images) after a run, printing the path so they can be inspected. Also refactors runner.New() from 6 positional arguments to a runner.Options struct for clarity and extensibility.
| --cog-ref REF Git ref to build cog from source | ||
| --sdk-wheel PATH Local SDK wheel path | ||
| --keep-images Keep Docker images after run | ||
| --keep-outputs Preserve prediction outputs (images, files) in the work directory |
There was a problem hiding this comment.
The help text here says "Preserve prediction outputs (images, files) in the work directory" but doesn't mention that the path will be printed. Consider updating to:
| --keep-outputs Preserve prediction outputs (images, files) in the work directory | |
| --keep-outputs Preserve prediction outputs and print the work directory path |
This better matches the actual behavior in runner.go:134 where it prints "Outputs preserved in: %s".
|
Posted a review on PR #2942. The only issue I found is a minor documentation inconsistency - the README mentions that |
Fix validateFileExists passing the full file path to mime.TypeByExtension instead of just the extension, causing MIME checks to always fail. Convert patcher and validator tests from raw t.Fatal/t.Errorf to testify assert/require, matching the project convention.
|
Found a minor documentation inconsistency: the README help text for |
…ages Docker image builds are expensive. Keeping them by default avoids wasteful rebuilds during iterative local development. Replace --keep-images with --clean-images for when explicit cleanup is wanted.
|
LGTM |
Co-authored-by: ask-bonk[bot] <249159057+ask-bonk[bot]@users.noreply.github.com> Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com>
|
LGTM |
…conditionally errcheck violations (unchecked error returns on Cleanup, RemoveAll, Close, Cmd.Run) and gocritic octal literal style (0644 -> 0o644). These were introduced in #2942 and went undetected because CI skipped Go lint when only Go files in tools/ changed.
Summary
--keep-outputsflag: Preserves the work directory (prediction output files like images) after a run, printing the path so they can be inspected instead of being automatically deleted.--keep-imageswith--clean-images. Images are now kept by default to avoid wasteful rebuilds during iterative local development.runner.New()constructor with arunner.Optionsstruct for clarity and extensibility.validateFileExistswas passing the full file path tomime.TypeByExtensioninstead of just the extension (e.g..png), causing MIME checks to always return empty and fail.patcherandvalidatortests from rawt.Fatal/t.Errorfto testifyassert/require, matching the project convention. Removes hand-rolledcontains/mapsEqualhelpers.Usage