Skip to content

Conversation

@rhdedgar
Copy link
Contributor

What does this PR do?

This PR fixes the handling of the external_providers_dir configuration field to align with its ongoing deprecation, in favor of the provider module specification approach.

It addresses the issue in #3950, where using the default provided run.yaml config resulted in the external_providers_dir parameter being set to the literal string None, and crashing the llama-stack server when starting.

Closes #3950

Test Plan

  • Built a new container image from podman build . -f containers/Containerfile --build-arg DISTRO_NAME=starter --tag llama-stack:starter
  • Tested it locally with podman run -it localhost/llama-stack:starter
  • Tested it on an OpenShift 4.19 cluster, deployed via the llama-stack-k8s-operator.

get_provider_registry,
)
from llama_stack.core.stack import cast_image_name_to_string, replace_env_vars
from llama_stack.core.utils.config_dirs import EXTERNAL_PROVIDERS_DIR
Copy link
Contributor

Choose a reason for hiding this comment

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

do you want to remove the definition of this constant as well?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think EXTERNAL_PROVIDERS_DIR is used elsewhere in the codebase

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi, I can confirm that EXTERNAL_PROVIDERS_DIR is still being used in the generate_run_config function in src/llama_stack/cli/stack/utils.py.

Copy link
Contributor

@cdoern cdoern left a comment

Choose a reason for hiding this comment

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

This looks reasonable, thanks!



def parse_and_maybe_upgrade_config(config_dict: dict[str, Any]) -> StackRunConfig:
version = config_dict.get("version", None)
Copy link
Contributor

Choose a reason for hiding this comment

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

question here, is this necessary? I might be missing something but this seems like a separate codepath.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No worries! This removes code that was used for an early-return micro optimization. Now that it's removed, it will apply the same processing to configs regardless of version.

E.g. configs with version 2 would've skipped the external_providers_dir processing steps that other configs would get.

The removals should align with the intended deprecation of external_providers_dir by treating it as optional here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PermissionError crash when external_providers_dir is not set in run.yaml

3 participants