fix: repair broken openadapt-ml imports in serve and train CLI commands#1001
Merged
Conversation
Fixes #999 (bug 1 and the train_start equivalent): - `openadapt serve` imported non-existent `serve_dashboard` from openadapt_ml.cloud.local; the actual entry point is `cmd_serve`, which takes an argparse Namespace. Build the Namespace and open the browser from the CLI side (cmd_serve has no open option). - `openadapt train start` imported non-existent `train_main` from openadapt_ml.scripts.train and called it with kwargs that don't exist; the actual entry point is `main(config_path, capture_path, output_dir, open_dashboard, ...)`. Select a device-appropriate default config when none is given (resolved against packaged configs when available). - except ImportError blocks now print the underlying error and point at pip install "openadapt-ml[training]" instead of masking internal import failures as "openadapt-ml not installed" (the misleading error that prompted the issue). Companion to OpenAdaptAI/openadapt-ml#63. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- serve now points openadapt_ml.cloud.local.TRAINING_OUTPUT at the requested --output directory instead of silently ignoring the flag - train start exits with a clear message when the config path can't be resolved (older openadapt-ml without bundled configs), instead of a FileNotFoundError traceback Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the
OpenAdapt-side bugs from #999 (reported by @ultimus247):openadapt serveandopenadapt train startboth failed with a misleading "openadapt-ml not installed" error becausecli.pyimported functions that don't exist inopenadapt-ml, and the bareexcept ImportErrorblocks swallowed the real cause.serve_dashboard→cmd_serve(argparse.Namespace(...))(the actual API). Browser opening now happens CLI-side sincecmd_servehas no open flag.train_main→scripts.train.main(config_path=..., capture_path=..., output_dir=..., open_dashboard=...)(the actual API and parameter names). When--configisn't given, selects the device-appropriate default and resolves it against the configs bundled in the openadapt-ml wheel (via the newresolve_config_path, with graceful fallback for older openadapt-ml).pip install "openadapt-ml[training]", addressing the "masked errors" complaint directly.Companion to OpenAdaptAI/openadapt-ml#63, which fixes the internal-import, CPU-training, and config-packaging bugs on the openadapt-ml side. Full repro from the issue (
openadapt serve,openadapt train start --capture ...) requires both PRs.Verification
python -m py_compile openadapt/cli.pycmd_serve,detect_device,resolve_config_path, andscripts.train.mainall exist with the parameters cli.py now uses🤖 Generated with Claude Code