Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cloud): respect user-set BENTOML_HOME #1067

Merged
merged 1 commit into from
Aug 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/openllm/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
app = OpenLLMTyper()


def resolve_cloud_config() -> pathlib.Path:
env = os.environ.get('BENTOML_HOME')
if env is not None:
return pathlib.Path(env) / '.yatai.yaml'
return pathlib.Path.home() / 'bentoml' / '.yatai.yaml'


def _get_deploy_cmd(bento: BentoInfo, target: typing.Optional[DeploymentTarget] = None):
cmd = ['bentoml', 'deploy', bento.bentoml_tag]
env = {'BENTOML_HOME': f'{bento.repo.path}/bentoml'}
Expand Down Expand Up @@ -53,8 +60,10 @@ def _get_deploy_cmd(bento: BentoInfo, target: typing.Optional[DeploymentTarget]
if target:
cmd += ['--instance-type', target.name]

assert (pathlib.Path.home() / 'bentoml' / '.yatai.yaml').exists()
shutil.copy(pathlib.Path.home() / 'bentoml' / '.yatai.yaml', bento.repo.path / 'bentoml' / '.yatai.yaml')
base_config = resolve_cloud_config()
if not base_config.exists():
raise Exception('Cannot find cloud config.')
shutil.copy(base_config, bento.repo.path / 'bentoml' / '.yatai.yaml')

return cmd, env, None

Expand Down