mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-28 11:42:00 +00:00
refactor: Add ProviderContext for a flexible storage directory
- Introduce ProviderContext class to decouple provider storage paths from absolute paths - Add storage_dir attribute to StackRunConfig to accept CLI options - Implement storage directory resolution with prioritized fallbacks: 1. CLI option (--state-directory) 2. Environment variable (LLAMA_STACK_STATE_DIR) 3. Default distribution directory - Standardize provider signatures to follow context, config, deps pattern - Update provider implementations to use the new context-based approach - Add comprehensive tests to verify state directory resolution
This commit is contained in:
parent
dd07c7a5b5
commit
e6c9aebe47
41 changed files with 242 additions and 81 deletions
|
|
@ -59,6 +59,11 @@ class StackRun(Subcommand):
|
|||
help="Image Type used during the build. This can be either conda or container or venv.",
|
||||
choices=[e.value for e in ImageType],
|
||||
)
|
||||
self.parser.add_argument(
|
||||
"--storage-directory",
|
||||
type=str,
|
||||
help="Directory to use for provider state (overrides environment variable and default).",
|
||||
)
|
||||
|
||||
# If neither image type nor image name is provided, but at the same time
|
||||
# the current environment has conda breadcrumbs, then assume what the user
|
||||
|
|
@ -118,6 +123,9 @@ class StackRun(Subcommand):
|
|||
except AttributeError as e:
|
||||
self.parser.error(f"failed to parse config file '{config_file}':\n {e}")
|
||||
|
||||
# Pass the CLI storage directory option to run_config for resolver use
|
||||
config.storage_dir = args.storage_directory
|
||||
|
||||
image_type, image_name = self._get_image_type_and_name(args)
|
||||
|
||||
# If neither image type nor image name is provided, assume the server should be run directly
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue